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: ? Quote Link to comment 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. Quote Link to comment 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.