Hi,
I am using Dreamweaver to generate some code for an Update Record and then trying to alter this further. I would like to enter data into a database using ‘Update’ then do a subsequent Update which further alters that data. I am trying with the example code below to get this to work. What I need is a bit more complicated but if I can get this work I should be able to work out the rest. However, it enters the form data fine but the second Update just isnt going into the database. If anyone can help with this that would be greatly appreciated:
[COLOR=“DarkGreen”]if ((isset($_POST[“MM_update”])) && ($_POST[“MM_update”] == “form2”)) {
$updateSQL = sprintf(“UPDATE table SET Fieldname=%s, Fieldname2=%s, Fieldname3=%s, Fieldname4=0.2 WHERE id=%s”,
GetSQLValueString($_POST[‘Fieldname’], “text”),
GetSQLValueString($_POST[‘Fieldname2’], “int”),
GetSQLValueString($_POST[‘Fieldname3’], “int”),
// GetSQLValueString($_POST[‘Fieldname4’], “double”),
GetSQLValueString($_POST[‘id’], “int”));
mysql_select_db($database_stuff_db, $stuff_db);
$Result1 = mysql_query($updateSQL, $stuff_db) or die(mysql_error());
$updateGoTo = “Newpage.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$updateGoTo .= (strpos($updateGoTo, ‘?’)) ? “&” : “?”;
$updateGoTo .= $_SERVER[‘QUERY_STRING’];
}
header(sprintf(“Location: %s”, $updateGoTo));
}
mysql_select_db($database_stuff_db, $stuff_db);
$query_update1=“UPDATE table SET Fieldname4=321 WHERE id=102”;
$update1 = mysql_query($query_update1, $stuff_db) or die(mysql_error());[/COLOR]
Ta,
HB