figa11 Posted October 21, 2010 Share Posted October 21, 2010 I never have written php or mysql, I usually just buy the sites and upload them. Can someone please tell me why I'm getting this error? Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/index.php on line 49 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/dailyroutine.php on line 30 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/dailyroutine.php on line 70 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/figa11/public_html/investments/dailyroutine.php on line 152 Quote Link to comment https://forums.phpfreaks.com/topic/216518-mysql-error/ Share on other sites More sharing options...
eran Posted October 21, 2010 Share Posted October 21, 2010 You have failing queries. mysql_query() returns a resource or a boolean false - the error is telling you that you trying to pass a failed query result into mysql_num_rows() which expects a mysql result resource. You need to perform a check before passing a mysql_query(), something of the form $result = mysql_query(...); if($result) { //use result in mysql_num_rows or any other relevant function } else { // debug / log error using mysql_error() } Quote Link to comment https://forums.phpfreaks.com/topic/216518-mysql-error/#findComment-1125042 Share on other sites More sharing options...
figa11 Posted October 22, 2010 Author Share Posted October 22, 2010 You have failing queries. mysql_query() returns a resource or a boolean false - the error is telling you that you trying to pass a failed query result into mysql_num_rows() which expects a mysql result resource. You need to perform a check before passing a mysql_query(), something of the form $result = mysql_query(...); if($result) { //use result in mysql_num_rows or any other relevant function } else { // debug / log error using mysql_error() } Am i supposed to add that code somewhere inside the code on my site Thanks very much for your response Quote Link to comment https://forums.phpfreaks.com/topic/216518-mysql-error/#findComment-1125044 Share on other sites More sharing options...
Pikachu2000 Posted October 22, 2010 Share Posted October 22, 2010 Your query is failing. Post your code so we don't have to try to guess what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/216518-mysql-error/#findComment-1125095 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.