I got this error Warning: mysql_num_rows() expects parameter
1 to be resource, boolean given in my code is below
and here it line if(mysql_num_rows($res)>
The parameter that is a boolean is $res
. mysql_query
returns FALSE
on error:
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset,
mysql_query()
returns a resource on success, orFALSE
on error.
from http://php.net/manual/en/function.mysql-query.php.
So the problem is that your SQL query is invalid, maybe because partners_program
doesn't exist or because one of the fields doesn't exist.
A good start in debugging the problem is to remove the @
in front of mysql_query
. The @ suppresses all errors and is generally frowned upon. If your PHP settings are properly set up for debugging, you should then receive a descriptive error message. You could also for debugging purposes use mysql_error()
right after the mysql_query
for more details.
Also, mysql_*
functions has been deprecated for a long while now, so if it is possible, you should check out the pdo
or mysqli
libraries instead.