Jump to content

[SOLVED] Or statment in mysql query


topflight

Recommended Posts

Is it possible to use an or statement in a mysql query. Because I am trying to do a query to see if the member has board member accesses or HRO accesses or HM accesses or ed. If I do a and then I will get nothing back becuase a member will only have 1 of those not all. So is their a way to do an or statement in mysql query?

Link to comment
https://forums.phpfreaks.com/topic/149354-solved-or-statment-in-mysql-query/
Share on other sites

$mlist = mysql_query(" SELECT * FROM `members` WHERE `status` =1 AND `active` =1 AND `hm` =1 AND `ed` =1 AND `hr` =1 AND `bm` =1");

 

Here it is:

 

$mlist = mysql_query(" SELECT * FROM `members` WHERE `status` =1 AND `active` =1 AND (`hm` =1 OR `ed` =1) AND `hr` =1 AND `bm` =1");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.