Orionsbelter Posted May 10, 2008 Share Posted May 10, 2008 hi i have am making a ordering drop down menu for my online users to fliter out other users but am stuck at the mysql query if($order='admin'){ $staff='admin';} elseif($order='mod'){ $staff='mod';} i have the staff='$staff' in my query but if the dont want to order anyone how do i make it so $staff equals all staff. so both mods and admin are shown. Quote Link to comment Share on other sites More sharing options...
Barand Posted May 10, 2008 Share Posted May 10, 2008 something like <?php switch ($staff) { case 'admin' : case 'mod' : $where = "staff = '$staff'" ; break; case 'staff' : $where = "staff IN ('mod', 'admin')"; } $sql = "SELECT name FROM users WHERE $where"; ?> 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.