JudgementDay Posted February 3, 2012 Share Posted February 3, 2012 How can I select from a table based on either A or B? In PHP: if ($row['A'] || $row['B']) {echo "foobar";} In street talk: If the colour is A or B, then buy it. In MySQL: ? Link to comment https://forums.phpfreaks.com/topic/256298-how-to-select-on-the-condition-a-or-b/ Share on other sites More sharing options...
php_begins Posted February 3, 2012 Share Posted February 3, 2012 if its a query $query=select fields from tablename where fieldname='A' OR fieldname='B"; while($row=mysql_fetch_assoc($query)) { echo $row['fieldname']; } or something on the similar lines depending on what you need. Link to comment https://forums.phpfreaks.com/topic/256298-how-to-select-on-the-condition-a-or-b/#findComment-1313892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.