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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -