how to get the number of rows of mysql db with php -
i number of rows of mysql database table 1 single statement or function
include "opendatabase.php"; //opens database while (numberofrows > 0){ //do } the numberofrows should replaced statement returns number of rows
i tried create function
function getrownumber(){ $query = "select count(*) `votes`"; $result = mysql_query($query, $connect); list($length) = mysql_fetch_row($result); return $length; } but not work if dont put include "opendatabase.php"; in it.
what doing wrong
$result = mysql_query("select * tablename"); if (mysql_num_rows($result) > 0) { // rows found.. }
Comments
Post a Comment