Jump to content

HELP!! Update Syntax Error!!


xiaoxin22

Recommended Posts

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='[email protected]'' at line 1

 

Hope my informations is enough.

Thank You.

Link to comment
https://forums.phpfreaks.com/topic/185052-help-update-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.