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. Link to comment https://forums.phpfreaks.com/topic/92069-stupid-query-problem/ 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']"; Link to comment https://forums.phpfreaks.com/topic/92069-stupid-query-problem/#findComment-471477 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) Link to comment https://forums.phpfreaks.com/topic/92069-stupid-query-problem/#findComment-471480 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 ([email protected],'c5dedfe8df822a7d3d9103' at line 1 any ideas why i suck at SQL Link to comment https://forums.phpfreaks.com/topic/92069-stupid-query-problem/#findComment-471483 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. Link to comment https://forums.phpfreaks.com/topic/92069-stupid-query-problem/#findComment-471490 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 Link to comment https://forums.phpfreaks.com/topic/92069-stupid-query-problem/#findComment-471518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.