Jump to content

[SOLVED] Stuck on SQL Query


Petty_Crim

Recommended Posts

I'm stuck on this sql query that gets a list of users that can be made into moderators. I got a database with a table called category_moderators, which has two fields category_id and user_id. I'm making a drop down list of available users that can be made into moderators, but I only want to display users who are currently not a moderator for that particular category.

 

This is my query I'm using atm:

$get_moderators=mysql_query("SELECT users.user_id, users.user_name FROM users, category_moderators WHERE (category_moderators.category_id='$chosen_category_id' AND users.user_id!=category_moderators.user_id)")

 

Before this query is run the user picks the category they want to add the moderator to as such if they pick say category 1 then the query should exclude listing users that are moderators in category 1.

Link to comment
https://forums.phpfreaks.com/topic/75610-solved-stuck-on-sql-query/
Share on other sites

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.