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. Quote 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] Quote 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!! Quote 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"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/83683-solved-select-and-error/#findComment-425778 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.