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? Link to comment https://forums.phpfreaks.com/topic/46130-mysql_num_rows-problem/ 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%'"); Link to comment https://forums.phpfreaks.com/topic/46130-mysql_num_rows-problem/#findComment-224173 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 Link to comment https://forums.phpfreaks.com/topic/46130-mysql_num_rows-problem/#findComment-224174 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); Link to comment https://forums.phpfreaks.com/topic/46130-mysql_num_rows-problem/#findComment-224175 Share on other sites More sharing options...
MadTechie Posted April 8, 2007 Share Posted April 8, 2007 LOL 3 hits Link to comment https://forums.phpfreaks.com/topic/46130-mysql_num_rows-problem/#findComment-224176 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!!! Link to comment https://forums.phpfreaks.com/topic/46130-mysql_num_rows-problem/#findComment-224188 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.