aussiefly Posted February 20, 2008 Share Posted February 20, 2008 Hi everyone! I am getting a mysql syntax error when I stick this query in my script. $insert ="UPDATE `members` SET (email, password, phone) VALUES ('$_POST[email]','.md5($_POST[password]).','.$_POST[phone]') WHERE `members`.`email` = $_SESSION[email]"; Its probably a bit of a sloppy query...i'm updating some user settings via a form. any idea what i'm missing??? Ity's the first time I've tried to update multiple fields etc. Quote Link to comment Share on other sites More sharing options...
flyclassic Posted February 20, 2008 Share Posted February 20, 2008 $insert ="UPDATE `members` SET (email, password, phone) VALUES ('$_POST','md5($_POST[password])','$_POST[phone]') WHERE `members`.`email` = $_SESSION['email']"; Quote Link to comment Share on other sites More sharing options...
Sulman Posted February 20, 2008 Share Posted February 20, 2008 Try this: <?php $insert ="UPDATE `members` SET (email, password, phone) VALUES ('".$_POST[email]."','".md5($_POST[password])."','".$_POST[phone]."') WHERE `members`.`email` =".$_SESSION[email]; ?> There was a couple of syntax errors (quotes missing) Quote Link to comment Share on other sites More sharing options...
aussiefly Posted February 20, 2008 Author Share Posted February 20, 2008 yup i've tried all of those solutions and im still getting a syntax error when i click the submit. 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 '(email, password, phone) VALUES (randomemail@email.com,'c5dedfe8df822a7d3d9103' at line 1 any ideas why i suck at SQL Quote Link to comment Share on other sites More sharing options...
Sulman Posted February 20, 2008 Share Posted February 20, 2008 Echo out your sql statement before you query the db. What does it look like? Looking at your message above there are quotes missing from around the email address. Quote Link to comment Share on other sites More sharing options...
aussiefly Posted February 20, 2008 Author Share Posted February 20, 2008 Thanks everyone. I managed to get around it and get the script to work. I apologise for all my newbyness Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.