I'm trying to return a number of records in a table using mysql_num_rows();
I'm having issues however, I get the following message:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in d:\....
For the sake of learning PHP i simply copied this code from a tutorial and plugged my info in, thinking I'd get it to work and disect it. No such luck.
I've been able to run insert statements, but for some reason the mysql_num_rows() isn't working. The code I use is posted below.
Any ideas? THANKS!
$dbhost = 'my.remote.mysqlserver';
$dbuser = 'myusername';
$dbpass = 'mypassword';
$dbname = 'mydatabase';
$link = mysql_connect($dbhost, $dbuser, $dbpass);
$result = mysql_query("SELECT * FROM myTable", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";