mendhak
May 16th, 2003, 06:09 AM
I have mySQL running on my computer here, and all works fine: using PHP I can enter data, and view it.
However, on the server, it just won't work.
I keep getting this error:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/mendhak/public_html/slambook/view.php on line 23
The code I'm using is
$dbh=mysql_connect("localhost", "mendhak_hello", "zzz") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("slambook");
$abcquery = "SELECT * FROM slambook;";
$result = mysql_query($abcquery);
echo $result;
$rowsonthispage = mysql_numrows($result); //this is line 23, where the error is occuring
echo "There are $rowsonthispage rows in total";
mysql_close();
I've also tried using mysql_num_rows, and I still get the same error. Now, it's obvious there's a problem with what $result is retrieving, but why is that? The query is perfectly fine. The database name is slambook, and the table name is also slambook... is that causing problems?
What can I do to resolve this problem?
However, on the server, it just won't work.
I keep getting this error:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/mendhak/public_html/slambook/view.php on line 23
The code I'm using is
$dbh=mysql_connect("localhost", "mendhak_hello", "zzz") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("slambook");
$abcquery = "SELECT * FROM slambook;";
$result = mysql_query($abcquery);
echo $result;
$rowsonthispage = mysql_numrows($result); //this is line 23, where the error is occuring
echo "There are $rowsonthispage rows in total";
mysql_close();
I've also tried using mysql_num_rows, and I still get the same error. Now, it's obvious there's a problem with what $result is retrieving, but why is that? The query is perfectly fine. The database name is slambook, and the table name is also slambook... is that causing problems?
What can I do to resolve this problem?