katlis Posted July 5, 2008 Share Posted July 5, 2008 SELECT * FROM horses WHERE status='1' (AND discipline='%jumper%' OR discipline='%dressage%') AND breed = 'Warmblood' ORDER BY showname ASC LIMIT 0, 20 The discipline column has comma separated values such as "jumper,hunter" .. or.. "dressage,jumper,hunter prospect" hence the wild cards. Yet this doesn't select anything from the table. Link to comment https://forums.phpfreaks.com/topic/113373-solved-whats-wrong-with-this-mysql-query/ Share on other sites More sharing options...
themistral Posted July 5, 2008 Share Posted July 5, 2008 You will probably need to use LIKE instead of = for checking text strings. Link to comment https://forums.phpfreaks.com/topic/113373-solved-whats-wrong-with-this-mysql-query/#findComment-582466 Share on other sites More sharing options...
katlis Posted July 5, 2008 Author Share Posted July 5, 2008 Thanks, worked. Also had to move AND before the parentheses. Link to comment https://forums.phpfreaks.com/topic/113373-solved-whats-wrong-with-this-mysql-query/#findComment-582510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.