phpretard Posted October 18, 2008 Share Posted October 18, 2008 Can anyone see why this would return error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource $searchResult = mysql_query("SELECT * FROM members WHERE LicState LIKE '%$SEARCH%' OR LicState2 '%$SEARCH%' OR LicState3 LIKE '%$SEARCH%' OR LicState4 LIKE '%$SEARCH%' "); if (!sql){die(mysql_error());} $num_rows = mysql_num_rows($searchResult); echo $num_rows." FOUND"; Thanks! Link to comment https://forums.phpfreaks.com/topic/128936-solved-numrows-help-please/ Share on other sites More sharing options...
JasonLewis Posted October 18, 2008 Share Posted October 18, 2008 You're query is failing. The if() statement should read: if(!$searchResult){ die(mysql_error()); } Anything that results in an invalid MySQL Result Resource means that the query you can has something wrong with it. It's best to put queries in multiple lines as well, for readability and because it will tell you the error the line is on. SELECT * FROM members WHERE LicState LIKE '%$SEARCH%' OR LicState2 '%$SEARCH%' OR LicState3 LIKE '%$SEARCH%' OR LicState4 LIKE '%$SEARCH%' Link to comment https://forums.phpfreaks.com/topic/128936-solved-numrows-help-please/#findComment-668482 Share on other sites More sharing options...
jamesbrauman Posted October 18, 2008 Share Posted October 18, 2008 $searchResult = mysql_query("SELECT * FROM members WHERE LicState LIKE '%$SEARCH%' OR LicState2 LIKE '%$SEARCH%' OR LicState3 LIKE '%$SEARCH%' OR LicState4 LIKE '%$SEARCH%' "); Link to comment https://forums.phpfreaks.com/topic/128936-solved-numrows-help-please/#findComment-668486 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.