close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update doesn't work

Thread began 7/22/2010 6:39 am by biesheuvel378713 | Last modified 7/22/2010 4:49 pm by Jason Byrnes | 657 views | 5 replies |

biesheuvel378713

Update doesn't work

When I create pages with the Data Assist wizard the update doesn't work. If I try to update a reacord I get this message:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@chello.nlundefined WHERE `ID`=2' at line 1

Where ID is the primary key, am I doing something wrong or can I change some code somewhere?

Sign in to reply to this post

CraigRBeta Tester

can you post your page code or the select statement.

there is an error in the sql syntax causing your problem

Sign in to reply to this post

biesheuvel378713

Here is the code for the update page, if you need more please let me know...


<?php require_once('Connections/phptest.php'); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
?>
<?php
$ParamID_WADAda_user = "-1";
if (isset($_GET['ID'])) {
$ParamID_WADAda_user = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_phptest, $phptest);
$query_WADAda_user = sprintf("SELECT ID, Name, LastName, email FROM da_user WHERE ID = %s", GetSQLValueString($ParamID_WADAda_user, "int"));
$WADAda_user = mysql_query($query_WADAda_user, $phptest) or die(mysql_error());
$row_WADAda_user = mysql_fetch_assoc($WADAda_user);
$totalRows_WADAda_user = mysql_num_rows($WADAda_user);?>
<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $phptest;
$WA_table = "da_user";
$WA_redirectURL = "da_user_Detail.php?ID=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_keepQueryString = false;
$WA_indexField = "ID";
$WA_fieldNamesStr = "Name|LastName|email";
$WA_fieldValuesStr = "".((isset($_POST["Name"]))?$_POST["Name"]:"") ."" . "|" . "".((isset($_POST["LastName"]))?$_POST["LastName"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."";
$WA_columnTypesStr = "undefined|undefined|undefined";
$WA_comparisonStr = " = | = | = ";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_phptest;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Update da_user</title>
<link href="WA_DataAssist/styles/Ultramodern_Nautica.css" rel="stylesheet" type="text/css" />
<link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div class="WADAUpdateContainer">
<?php if ($totalRows_WADAda_user > 0) { // Show if recordset not empty ?>
<form action="da_user_Update.php?ID=<?php echo(rawurlencode($row_WADAda_user['ID'])); ?>" method="post" name="WADAUpdateForm" id="WADAUpdateForm">
<div class="WADAHeader">Update Record</div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">ID:</th>
<td class="WADADataTableCell"><?php echo(str_replace('"', '&quot;', $row_WADAda_user['ID'])); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Name:</th>
<td class="WADADataTableCell"><input type="text" name="Name" id="Name" value="<?php echo(str_replace('"', '&quot;', $row_WADAda_user['Name'])); ?>" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">LastName:</th>
<td class="WADADataTableCell"><input type="text" name="LastName" id="LastName" value="<?php echo(str_replace('"', '&quot;', $row_WADAda_user['LastName'])); ?>" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">email:</th>
<td class="WADADataTableCell"><input type="text" name="email" id="email" value="<?php echo(str_replace('"', '&quot;', $row_WADAda_user['email'])); ?>" size="32" /></td>
</tr>
</table>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Update" id="Update" value="Update" alt="Update" src="WA_DataAssist/images/Nautica/Ultramodern_update.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="da_user_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="WA_DataAssist/images/Nautica/Ultramodern_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAUpdateRecordID" type="hidden" id="WADAUpdateRecordID" value="<?php echo(rawurlencode($row_WADAda_user['ID'])); ?>" />
</div>
</form>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_WADAda_user == 0) { // Show if recordset empty ?>
<div class="WADANoResults">
<div class="WADANoResultsMessage">No record found.</div>
</div>
<?php } // Show if recordset empty ?>
</div>
</body>
</html>
<?php
mysql_free_result($WADAda_user);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

in the future, please compress the php file into a zip archive rather than pasting the page code, it is easier to read that way.


The data types in the update record behavior are not set correctly.

Double click the update record behavior and make sure that the data type for each of the columns is set to text.

Sign in to reply to this post

biesheuvel378713

Thank you for the quick reply, now I know what to do.

When setting the data type for each column I have to set one column at a time and then press back and next to set the next column. That's why the data types where not set correctly, so it's a litle error in the dialog.

For the rest it's a fine product!

(Next time I will send a zip)

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...