Answers for "how to count how many rows in sql table php"

PHP
2

get count sql query in php

$result=mysql_query("SELECT count(*) as total from Students");
$data=mysql_fetch_assoc($result);
echo $data['total'];
Posted by: Guest on February-18-2021
0

php foreach count rows

<?php

$count = 0;

foreach( $names as $name){

$count = $count + 1;

echo  "<td>".$count. "</td>

      "<td>".$name. "</td>";
}

echo $count;

?>
Posted by: Guest on February-16-2021

Code answers related to "how to count how many rows in sql table php"

Browse Popular Code Answers by Language