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) 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)) { // .. } } 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. 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. Link to comment https://forums.phpfreaks.com/topic/116553-php-warningmysql_num_rows/#findComment-599339 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.