Here is my code:
$updated_info = "INSERT INTO Roster (fname, lname, email, phone) VALUES ('$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[phone]') WHERE id = " . $id
I get an error:
Invalid syntax near 'WHERE id = 4'.
What am I doing wrong??
Thanks
Insert/Update Question
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
edited due to above post
good point, god im tired today
does that work?
good point, god im tired today
for starters.....Code: Select all
$updated_info = "INSERT INTO Roster (fname, lname, email, phone) VALUES ('$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[phone]') WHERE id = " . $id
Code: Select all
$updated_info = "INSERT INTO Roster (fname, lname, email, phone) VALUES ('$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[phone]') WHERE id = " . $id""- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Good way to check invalid syntax, look at the actual syntax:
http://www.mysql.com/doc/en/INSERT.html
Mac
http://www.mysql.com/doc/en/INSERT.html
Mac