xiaoxin22 Posted December 14, 2009 Share Posted December 14, 2009 below is the sql query i typed for my php.. i'm trying to update my database through the $_POST i got from the previous page but couldn't work. there's syntax error. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) { $updateSQL = sprintf("UPDATE user SET user_company=%s, user_contact=%s, user_ic=%s, user_pw=%s, WHERE user_email=%s", GetSQLValueString($_POST['Company'], "text"), GetSQLValueString($_POST['Contact'], "text"), GetSQLValueString($_POST['IC'], "text"), GetSQLValueString($_POST['Password'], "text"), GetSQLValueString($_SESSION['MM_Username'], "text")); mysql_select_db($database_db_crm, $db_crm); $Result1 = mysql_query($updateSQL, $db_crm) or die(mysql_error()); $updateGoTo = "update_success.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } this is the syntax error i got. 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 'WHERE user_email='yesicreated@gmail.com'' at line 1 Hope my informations is enough. Thank You. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 14, 2009 Share Posted December 14, 2009 You already have a thread for this problem. Don't start another one. Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 check this out GetSQLValueString($_SESSION['MM_Username'], "text")); i think if u remove the GetSQLValueString it will work.. Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 14, 2009 Share Posted December 14, 2009 you have an un-needed comma before your WHERE clause... 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.