andrew_ww Posted January 9, 2007 Share Posted January 9, 2007 How easy is it to add a message informing that update had been successful ?[code]<?php// Get MySQL connectionrequire_once('../required/conn.php');// Begin sessionif (!isset($_SESSION)) { session_start();}// If user session is not set redirect to login pageif(!isset($_SESSION['authenticated'])) { header("location: ../?notification=pleaselogin");}// Logout link$logout = $_SERVER['PHP_SELF']."?begone=true";// If user chooses to logout unset session and redirectif(isset($_REQUEST['begone']) && $_REQUEST['begone'] == true) { $_SESSION['authenticated'] = NULL; unset($_SESSION['authenticated']); header("location: ../index.php?notification=loggedout");}// Get user's ID from session$userID = $_SESSION['authenticated'];?><?php require_once('../Connections/db.php'); ?><?php$IP_LOG = $_SERVER["REMOTE_ADDR"];$HOSTNAME_LOG = gethostbyaddr($_SERVER['REMOTE_ADDR']);?><?php$colname_rs_table1 = "1";if (isset($_GET['recordID'])) { $colname_rs_table1 = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);}mysql_select_db($database_db, $db);//$query_rs_table1 = sprintf("SELECT * FROM tbl_table1 INNER JOIN table2 ON (tbl_table1.id = table2.id) WHERE table2.id = %s", $colname_rs_table1);$query_rs_table1 = sprintf("SELECT * FROM table2 WHERE table2.id = %s", $colname_rs_table1);$rs_table1 = mysql_query($query_rs_table1, $DII) or die(mysql_error());$row_rs_table1 = mysql_fetch_assoc($rs_table1);$totalRows_rs_table1 = mysql_num_rows($rs_table1);?><?phpfunction GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""){ $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue;}$editFormAction = $_SERVER['PHP_SELF'];if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);}if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE table2 SET sub=%s WHERE id=%s", GetSQLValueString($_POST['sub'], "text"), GetSQLValueString($_POST['id'], "int")); mysql_select_db($database_db, $db); $Result1 = mysql_query($updateSQL, $db) or die(mysql_error()); $updateGoTo = "index.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo));}?> [/code] Link to comment https://forums.phpfreaks.com/topic/33404-adding-confirmation-message/ Share on other sites More sharing options...
fert Posted January 9, 2007 Share Posted January 9, 2007 [code]echo "Update sucessful";[/code] Link to comment https://forums.phpfreaks.com/topic/33404-adding-confirmation-message/#findComment-156220 Share on other sites More sharing options...
andrew_ww Posted January 9, 2007 Author Share Posted January 9, 2007 Where does this go ?I was thinking of using an if statement, but I'm unsure as to what variable I should be testing it against?I tried previously but the if statement ran before the submit button has been loaded Link to comment https://forums.phpfreaks.com/topic/33404-adding-confirmation-message/#findComment-156223 Share on other sites More sharing options...
fert Posted January 9, 2007 Share Posted January 9, 2007 you would have to compare the value in the database before the update and after Link to comment https://forums.phpfreaks.com/topic/33404-adding-confirmation-message/#findComment-156224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.