Jump to content

What's wrong with this query?


Kemik

Recommended Posts

Hello,

 

I've made a page where a user is joining a team. I've successfully added them to the team_members table and adjusted their permissions. I know their user_id and the team_id for the team they wish to join.

 

I want to Select the team leader's email so I can send them an email.

 

The query needs to pull the leader_id from the teams table where the team_id matches $team_id. The query then needs to pull the email from the users table where user_id = leader_id.

 

Here's my current query:

 

SELECT c.leader_id, u.email, 
        		 FROM clans AS c 
         		 LEFT JOIN users AS u ON c.leader_id = u.user_id
        		 WHERE clan_id = $clan_id

 

However my database errors...

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM clans AS c LEFT JOIN users AS u ON c.leader_id = u.user_id ' at line 2

 

SELECT c.leader_id, u.email, FROM clans AS c LEFT JOIN users AS u ON c.leader_id = u.user_id WHERE clan_id = 1

 

Thanks for your help.

 

 

Link to comment
https://forums.phpfreaks.com/topic/65601-whats-wrong-with-this-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.