Hi,
can anyone tell me why the below PHP code keeps returning
mysql_num_rows(): supplied argument is not a valid MySQL result resource ??

$result = mysql_query("SELECT * FROM RewardGenUser WHERE UserID = 123");
$num = mysql_num_rows($result);

copy this line in the begining of your code and check what error message it is giving. correct your query and then try again.

error_reporting(E_ALL); 
	ini_set("display_errors", 1);
Member Avatar for rajarajan2017
$id="123";
$result = mysql_query("SELECT * FROM RewardGenUser WHERE UserID ='$id'");
$num = mysql_num_rows($result);

Try with the code and test it. if not, query is the problem. test with phpmyadmin

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.