A Problem - Mysql_numrows() function
Posted: Sat May 09, 2009 8:12 am
Can I ask what is wrong with the following code. I have studied it to try and find any errors in my code but there were none. On my page it says 'Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/casiodev/public_html/Downloads/downModule.php on line 36'
Thanks in advance for your help
Regards
Code: Select all
if(!empty($_GET["calc"]) && !empty($_GET["type"]) && empty($_GET['id'])) {
$calc = $_GET["calc"];
$type = $_GET["type"];
mysql_connect("localhost","casiodev_admin","********");
mysql_select_db("casiodev_web");
$query = "SELECT * FROM downloads WHERE 'calc' = %$calc% AND 'type'=%$type% ";
$result = mysql_query($query);
$num = mysql_numrows($result); // I have isolated the problem to this line
$i=0;
$top="135px";
echo "<div class=\"stdDiv\" style=\"left:11%;top:$top;height:300px;width:88%;\">";
echo "Calc: $calc <br />Type: $type";
while( $i < $num ) {
$name=mysql_result($result, $i, "name");
$description=mysql_result($result, $i, "description");
$downURL=mysql_result(result, $i, "downloads");
$author=mysql_result($result, $i, "uploader");
echo "<br />New Record<br />Name: $name<br />";
/*echo "Name: $name <br />";
echo "Description: $description <br />";
echo "Download URL: $downURL <br />";
echo "Program Author: $author <br />";
*/$i++;
}
echo "</div>";
} Thanks in advance for your help
Regards