0

I have the following SQL:

INSERT INTO Invite VALUES (NULL,?,(SELECT id FROM User WHERE name = ?),?); 

However this doesnt seem to work.

Can anyone tell me what i am doing wrong?

Update

The following php code gives me erro code 1136:

 $sql = 'INSERT INTO Invite SELECT NULL, ?, id, ? FROM User WHERE username = ?'; $variables = array($team_id,$_SESSION['User']['id'],$username); $result = $this->db->prepTemplate($sql, 'iis', $variables); 
1
  • code 1136 clearly mention error "Column count doesn't match value count". Check the number of columns in table Invite. Commented Jan 14, 2014 at 5:14

1 Answer 1

3
INSERT INTO Invite SELECT NULL, ?, id, ? FROM User WHERE name = ? 
Sign up to request clarification or add additional context in comments.

1 Comment

i cannot get the following to work: INSERT INTO Invite SELECT NULL, ?, id, ? FROM User WHERE username = ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.