I'm having troubles updating information in mySQL database. Can anybody look through the code below and tell me what is going wrong?
BTW: I am able to add new records but not update a record.
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "update")) {
$updateSQL = sprintf("UPDATE Login SET email=%s, firstname=%s, lastname=%s, date=%s, address=%s, city=%s, state=%s, zip=%s WHERE username=%s",
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['firstName'], "text"),
GetSQLValueString($_POST['lastName'], "text"),
GetSQLValueString($_POST['wedDate'], "date"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['city'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['zip'], "text"),
GetSQLValueString($_POST['username'], "text"));
mysql_select_db($database_snsphp, $snsphp);
$Result1 = mysql_query($updateSQL, $snsphp) or die(mysql_error());
$updateGoTo = "success.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
I am fairly new to mySQL but have worked with PHP for about a year and a half. Still not really getting the hang of all the querries.
LS