I have a query that pulls users in a list. It pulls a list of people that you can “fight”, You shouldn’t be able to fight yourself, or fight someone in your “clan”.
$select = mysql_query("SELECT id,username,clan FROM `users` WHERE username != '".$user['username']."' AND IF clan>0 THEN clan != ".$user['clan']."");
This query “tries” to see if the selected row’s clan > 0 “Means they are in a clan”, then it should see if they are in the same clan as the user. IF so, skip that row. Also, it is worth nothing that if you aren’t in a clan, you should be able to fight others also not in a clan (0).
- Can’t fight yourself
- Or anyone in your clan
Thanks 🙂
Try this: