Forums
This topic is locked
Phakt update record behaviour problems - help
Posted 25 Nov 2005 22:03:59
1
has voted
25 Nov 2005 22:03:59 Kent Villard posted:
I created an update page (the bloody table only has 2 fields) using the update record behaviour in Phakt -It propagates the info fine but when I click the form submit to update the record I get this error:
ERROR: syntax error at or near "`" at character 54
I can't seem to figure out what the error is. The code looks okay but what do I know - please someone help me so I don't have to code the other 20 table updates by hand <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
(note I have not used anything other than the gui to enter info, I have not tampered with the generated code - Dreamweaver MX 2004, Phakt 3.5.1, PostgreSQL 7.x.x and PHP 4.3.2)
If ANYONE can help I'll be very greatful:
Here is the code it generates:
<pre id=code><font face=courier size=2 id=code>
<?php
//Connection statement
require_once('../Connections/testconnection.php');
//Aditional Functions
require_once('../includes/functions.inc.php');
// build the form action
$editFormAction = $_SERVER['PHP_SELF'] . (isset($_SERVER['QUERY_STRING']) ? "?" . $_SERVER['QUERY_STRING'] : ""
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1") {
$updateSQL = sprintf("UPDATE jp_total_gdp SET island_id=%s, gdp=%s, `year`=%s WHERE total_gdp_id=%s",
GetSQLValueString($_POST['island_id'], "int",
GetSQLValueString($_POST['gdp'], "int",
GetSQLValueString($_POST['year'], "int",
GetSQLValueString($_POST['total_gdp_id'], "int");
$Result1 = $testconnection->Execute($updateSQL) or die($testconnection->ErrorMsg());
$updateGoTo = "list-total-gdp.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
KT_redir($updateGoTo);
}
// begin Recordset
$colname__UpdateTotalGDPEntry = '-1';
if (isset($_GET['gdpid'])) {
$colname__UpdateTotalGDPEntry = $_GET['gdpid'];
}
$query_UpdateTotalGDPEntry = sprintf("SELECT * FROM jp_total_gdp WHERE total_gdp_id = %s", $colname__UpdateTotalGDPEntry);
$UpdateTotalGDPEntry = $testconnection->SelectLimit($query_UpdateTotalGDPEntry) or die($testconnection->ErrorMsg());
$totalRows_UpdateTotalGDPEntry = $UpdateTotalGDPEntry->RecordCount();
// end Recordset
// begin Recordset
$colname__GetIslandName = '-1';
if (isset($_GET['id'])) {
$colname__GetIslandName = $_GET['id'];
}
$query_GetIslandName = sprintf("SELECT * FROM jp_islands WHERE island_id = %s", $colname__GetIslandName);
$GetIslandName = $testconnection->SelectLimit($query_GetIslandName) or die($testconnection->ErrorMsg());
$totalRows_GetIslandName = $GetIslandName->RecordCount();
// end Recordset
//PHP ADODB document - made with PHAkt 3.5.1?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p><strong><font size="+2" face="Arial, Helvetica, sans-serif">Updating Total GDP Entry for: <br>
<font color="#3366cc"><?php echo $GetIslandName->Fields('island_name'); ?></font></font></strong>
<hr size="1" noshade>
</p>
<form method="POST" id="form1" action="<?php echo $editFormAction; ?>">
<table border="1" cellpadding="3" cellspacing="0">
<tr valign="baseline">
<td nowrap align="right">GDP:</td>
<td><input type="text" name="gdp" value="<?php echo $UpdateTotalGDPEntry->Fields('gdp'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Year:</td>
<td><input type="text" name="year" value="<?php echo $UpdateTotalGDPEntry->Fields('year'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Update Record!" /></td>
</tr>
</table>
<input type="hidden" name="island_id" value="<?php echo $UpdateTotalGDPEntry->Fields('island_id'); ?>" />
<input type="hidden" name="total_gdp_id" value="<?php echo $UpdateTotalGDPEntry->Fields('total_gdp_id'); ?>" />
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="total_gdp_id" />
</form>
<p> </p>
<p><?php include('footer.html'); ?> </p>
</body>
</html>
<?php
$UpdateTotalGDPEntry->Close();
$GetIslandName->Close();
?>
</font id=code></pre id=code>
Edited by - TheMaxTor on 25 Nov 2005 22:07:13