HighDots Forums  

Simple Update Record Question...

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Simple Update Record Question... in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Leesa
 
Posts: n/a

Default Simple Update Record Question... - 07-21-2004 , 02:18 PM






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


Reply With Quote
  #2  
Old   
D. Shane Fowlkes
 
Posts: n/a

Default Re: Simple Update Record Question... - 07-21-2004 , 03:39 PM






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?

--


**************************************************
D. Shane Fowlkes
Web Applications Manager
Easter Associates, Inc.
1011 East Main Street
Suite 220
Richmond, VA 23219
(804) 643-4433
Fax: (804) 643-1033
shane (AT) easterassociates (DOT) com
**************************************************


"Leesa" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
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




Reply With Quote
  #3  
Old   
Leesa
 
Posts: n/a

Default Re: Simple Update Record Question... - 07-21-2004 , 09:40 PM



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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.