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. Link to comment https://forums.phpfreaks.com/topic/104992-help-me/ 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"; ?> Link to comment https://forums.phpfreaks.com/topic/104992-help-me/#findComment-537415 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.