vexx Posted July 25, 2008 Share Posted July 25, 2008 I'm on Mysql 5.0.51a-community and i get the following php warning PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/test/public_html/admin/testphp.php on line 24 The php code: if(mysql_num_rows(mysql_query("SELECT file FROM datadb WHERE file='".$purl."' LIMIT 0,1"))==0) Quote Link to comment https://forums.phpfreaks.com/topic/116553-php-warningmysql_num_rows/ Share on other sites More sharing options...
ignace Posted July 25, 2008 Share Posted July 25, 2008 your query most presumably failed try: $query = mysql_query("SELECT file FROM datadb WHERE file='".$purl."' LIMIT 0,1"); if (false !== $query) { if (0 !== mysql_num_rows($query)) { // .. } } Quote Link to comment https://forums.phpfreaks.com/topic/116553-php-warningmysql_num_rows/#findComment-599325 Share on other sites More sharing options...
waynew Posted July 25, 2008 Share Posted July 25, 2008 Add or die(mysql_error()); at the end of your query. Your query definitely failed. Quote Link to comment https://forums.phpfreaks.com/topic/116553-php-warningmysql_num_rows/#findComment-599335 Share on other sites More sharing options...
MasterACE14 Posted July 25, 2008 Share Posted July 25, 2008 if(mysql_num_rows(mysql_query("SELECT file FROM datadb WHERE file='".$purl."' LIMIT 0,1"))==0) geez.... separate em will ya. Its like 3rd degree eye slaughter. Quote Link to comment https://forums.phpfreaks.com/topic/116553-php-warningmysql_num_rows/#findComment-599339 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.