Forum Moderators: coopster
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/realpat/public_html/security/signupdemo.php on line 20
false
The code it is referencing:
$tempQuery = mysql_query("SELECT ID FROM security_images WHERE
referenceid='".$referenceid."' AND hiddentext='".$enteredvalue."'");
if (mysql_num_rows($tempQuery)!=0)
{
echo 'true';
} else {
echo 'false';
}
================================
What is wrong here? Is it compatibility issues? Or do I have to code a new way?
I'd start by using the double quotes to interpolate the vars and dont concat:
$tempQuery = mysql_query("SELECT ID FROM security_images WHERE referenceid='$referenceid' AND hiddentext='$enteredvalue'");
Then I'd check for a valid resource before doing something with it: is_resource().
If there was an error you can see it with mysql_error().
Or maybe your query didn't find anything.
$sql = "SELECT ID FROM security_images WHERE
referenceid='".mysql_real_escape_string($referenceid)."' AND hiddentext='".mysql_real_escape_string($enteredvalue)."'";
$tempQuery = mysql_query($sql) or die(mysql_error());if (mysql_num_rows($tempQuery)!=0)
{
echo 'true';
} else {
echo "false<br />SQL: $sql";
}
There should be any difference between concatenated and unconcatenated string
Michal