Hello'
I'm using following code and getting mysqlerror

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs/.....

Code is

$query="SELECT ('$retfield') FROM ('$table') WHERE ('$givefield')=('$val')";
$res=mysql_query($query);
if(mysql_num_rows($res) > 0){
    }

Upto my knowledge I'm using correct syntax bt I dnt where I'm going wrong.
Can anyone help me?

This will suffice:

$query="SELECT $retfield FROM $table WHERE $givefield='$val'";

This will suffice:

$query="SELECT $retfield FROM $table WHERE $givefield='$val'";

It works Thanx a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.