forumnz Posted December 30, 2007 Share Posted December 30, 2007 My code should select * from a db where something = something AND something LIKE.... Anyway, it basically ignore the addre as below: What could be wrong? $query = "SELECT * FROM cmads WHERE addre='5' AND keyw LIKE '%$trimmed%' OR buzzname LIKE '%$trimmed%' OR descr LIKE '%$trimmed%' OR sub LIKE '%$trimmed%' ORDER BY keyw"; Thanks, Sam. Link to comment https://forums.phpfreaks.com/topic/83683-solved-select-and-error/ Share on other sites More sharing options...
hitman6003 Posted December 30, 2007 Share Posted December 30, 2007 [code]Use parenthesis: [code] SELECT * FROM cmads WHERE addre='5' AND ( keyw LIKE '%$trimmed%' OR buzzname LIKE '%$trimmed%' OR descr LIKE '%$trimmed%' OR sub LIKE '%$trimmed%' ) ORDER BY keyw You will get dramatically different results depending on how you use them[/code][/code] Link to comment https://forums.phpfreaks.com/topic/83683-solved-select-and-error/#findComment-425775 Share on other sites More sharing options...
forumnz Posted December 30, 2007 Author Share Posted December 30, 2007 THANKS!! Link to comment https://forums.phpfreaks.com/topic/83683-solved-select-and-error/#findComment-425777 Share on other sites More sharing options...
redarrow Posted December 30, 2007 Share Posted December 30, 2007 try it this way ok. let me no if it works atleast cheers. <?php $query = "SELECT * FROM cmads WHERE addre='5' AND keyw LIKE '%".$trimmed."%' OR buzzname LIKE '%".$trimmed."%' OR descr LIKE '%".$trimmed."%' OR sub LIKE '%".$trimmed."%' ORDER BY keyw"; ?> Link to comment https://forums.phpfreaks.com/topic/83683-solved-select-and-error/#findComment-425778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.