Hello :
I tried to use mysqli_num_rows() to display how many rows are returned by queried result.
I got error message says, Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given. Please take look at my code see what went wrong. Thanks!
my php code :
<?php
$db_connect = mysqli_connect("localhost", "root", "mysqlpass");
if (!$db_connect)
{
echo "You didn't connect to database server<br />";
}
else{
echo "You connect to database server<br />";
$db = mysqli_select_db($db_connect, "country_index");
if($db)
{
echo " you connected to country_index database <br />";
}
else
{
echo " you didn't connect to country_index database <br />";
}
} //end of else statement
//$query = "select country from country_index";
$results = mysqli_query($db_connect, "select country from country_index");
$row_cnt = mysqli_num_rows($results);
// mysqli_num_rows($result);
echo $row_cnt;
mysqli_close($db_connect);
?>
P.S is there particular reason that mysqli command are used , I prefer use mysql command e.g. mysql_connect() etc.
Jeff
11-27-06