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! Quote Link to comment 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%' Quote Link to comment 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%' "); Quote Link to comment 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.