Simple Update Record Question...

message from Leesa on 21 Jul 2004
Hi,

My page works BUT when in design view, in the server behavior panel, there is
a red exclamation mark next to the Record Update behavior. I've opened it and
checked all the values and made sure the redirect page (which works) is
correct. Can't see anything wrong.

Is there a way to get DW to tell you what the ! mark is refering to? In other
instances it has by saying such and such a field not found if I changed the
name in the database or something. Everything works but that ! is driving me
nuts. I know something is going to come back and bite me later.

Page loads with no error messages.
PHP4.7.3/MySQL database updates fine with no error messages.
I get sent to the redirect page with no errors.
There is only one Start_Session() in the code.
Using DWMX2004 with update.

Is DW inserting updated PHP code? Maybe I'm overlooking something.
Here is the code that is highlighted when I click on the Update Record
behavior:

<?php
function 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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "UpdateUserInfo"))
{
$updateSQL = sprintf("UPDATE login SET FirstName=%s, LastName=%s,
HomePhone=%s, UserName=%s, Email=%s, UserUpdateInfoDate=%s WHERE UserID=%s",
GetSQLValueString($HTTP_POST_VARS['FirstName'], "text"),
GetSQLValueString($HTTP_POST_VARS['LastName'], "text"),
GetSQLValueString($HTTP_POST_VARS['HomePhone'], "text"),
GetSQLValueString($HTTP_POST_VARS['UserName'], "text"),
GetSQLValueString($HTTP_POST_VARS['Email'], "text"),

GetSQLValueString($HTTP_POST_VARS['UserUpdateInfoDate'], "text"),
GetSQLValueString($HTTP_POST_VARS['UserID'], "int"));

mysql_select_db($database_DMInfo, $DMInfo);
$Result1 = mysql_query($updateSQL, $DMInfo) or die(mysql_error());

$updateGoTo = "User_Confirm_Info.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_rsUpdateUserInfo = "1";
if (isset($_SESSION['UserID'])) {
$colname_rsUpdateUserInfo = (get_magic_quotes_gpc()) ? $_SESSION['UserID'] :
addslashes($_SESSION['UserID']);
}
mysql_select_db($database_DMInfo, $DMInfo);
$query_rsUpdateUserInfo = sprintf("SELECT UserID, FirstName, LastName,
HomePhone, UserName, Email FROM login WHERE UserID = %s",
$colname_rsUpdateUserInfo);
$rsUpdateUserInfo = mysql_query($query_rsUpdateUserInfo, $DMInfo) or
die(mysql_error());
$row_rsUpdateUserInfo = mysql_fetch_assoc($rsUpdateUserInfo);
$totalRows_rsUpdateUserInfo = mysql_num_rows($rsUpdateUserInfo);
?>

Thanks. Leesa
 
D. Shane Fowlkes replied to Leesa on 21 Jul 2004
I never use DW generated server side code - I simply prefer to do it by hand
or use VS.NET. However...if I remember correctly, you can ignore this. I
think it's simply a warning that the DW generated code..the "behavior" has
been modified in some way and *could* no longer work. I think when you dbl
click the application behavior, it simply rebuilds the PHP code to IT'S
liking. This is why just don't use it - because it would often overwrite or
disregard my picky changes after I used the behaviour. Make sense?
 
Leesa replied to D. Shane Fowlkes on 22 Jul 2004
Thanks! Yes it does. I have tweeked the code and everything works as I want
it to. I'm just not use to seeing the ! without some other connection like a
recordset being wrong or something.

Thanks again for answering.
 

Archived message: Simple Update Record Question... (Macromedia Dreamweaver Web Design)