help with code please
Posted: Fri Feb 06, 2004 7:00 am
I have two syntax problems with php.
First problem :
And i get the following error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in line $num_results=...
I have used the above code many times in the same site, and although it works fine in the other pages, in this one i get the error.
Any suggestions or hints???
Second problem
Same problem as above with error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Also this code works in other pages, not on this one.
Any suggestions or tips??
Thanks
First problem :
Code: Select all
<?php
$db = mysql_connect(...);
mysql_select_db("...",$db);
$myquery= "SELECT * FROM ..... ";
$result = mysql_query($myquery);
$num_results=mysql_num_rows($result);
?>I have used the above code many times in the same site, and although it works fine in the other pages, in this one i get the error.
Any suggestions or hints???
Second problem
Code: Select all
<?php
$myquery2 = "SELECT * FROM .......... ";
$sql = mysql_query($myquery2);
while($row = mysql_fetch_array($sql))
{
// format results here
}
?>Also this code works in other pages, not on this one.
Any suggestions or tips??
Thanks