pouncer Posted April 8, 2007 Share Posted April 8, 2007 $s1 = mysql_query("SELECT * FROM collection WHERE collection_name LIKE %old% OR collection_name LIKE %houses%"); echo mysql_num_rows($s1); error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result but when i change my query to: $s1 = mysql_query("SELECT * FROM collection"); then it works fine. can someone please tell me whats wrong? Quote Link to comment Share on other sites More sharing options...
esukf Posted April 8, 2007 Share Posted April 8, 2007 missing single quotes around strings $s1 = mysql_query("SELECT * FROM collection WHERE collection_name LIKE '%old%' OR collection_name LIKE '%houses%'"); Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 8, 2007 Share Posted April 8, 2007 You need to put the strings in the LIKEs in single quotes: <?php $s1 = mysql_query("SELECT * FROM collection WHERE collection_name LIKE '%old%' OR collection_name LIKE '%houses%'"); echo mysql_num_rows($s1); ?> Ken Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 8, 2007 Share Posted April 8, 2007 TRY $s1 = mysql_query("SELECT * FROM collection WHERE collection_name LIKE '%old%' OR collection_name LIKE '%houses%'"); echo mysql_num_rows($s1); Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 8, 2007 Share Posted April 8, 2007 LOL 3 hits Quote Link to comment Share on other sites More sharing options...
pouncer Posted April 8, 2007 Author Share Posted April 8, 2007 thanks alot guys, that pc_nerd guy mislead me, by telling me it was correct. Thanks guys!!! 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.