Forums

PHP

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>
&lt;?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-&gt;Execute($updateSQL) or die($testconnection-&gt;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-&gt;SelectLimit($query_UpdateTotalGDPEntry) or die($testconnection-&gt;ErrorMsg());
$totalRows_UpdateTotalGDPEntry = $UpdateTotalGDPEntry-&gt;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-&gt;SelectLimit($query_GetIslandName) or die($testconnection-&gt;ErrorMsg());
$totalRows_GetIslandName = $GetIslandName-&gt;RecordCount();
// end Recordset
//PHP ADODB document - made with PHAkt 3.5.1?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="+2" face="Arial, Helvetica, sans-serif"&gt;Updating Total GDP Entry for: &lt;br&gt;
&lt;font color="#3366cc"&gt;&lt;?php echo $GetIslandName-&gt;Fields('island_name'); ?&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;
&lt;hr size="1" noshade&gt;
&lt;/p&gt;
&lt;form method="POST" id="form1" action="&lt;?php echo $editFormAction; ?&gt;"&gt;
&lt;table border="1" cellpadding="3" cellspacing="0"&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;GDP:&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="gdp" value="&lt;?php echo $UpdateTotalGDPEntry-&gt;Fields('gdp'); ?&gt;" size="32" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt;Year:&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="year" value="&lt;?php echo $UpdateTotalGDPEntry-&gt;Fields('year'); ?&gt;" size="32" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign="baseline"&gt;
&lt;td nowrap align="right"&gt; &lt;/td&gt;
&lt;td&gt;&lt;input type="submit" value="Update Record!" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;input type="hidden" name="island_id" value="&lt;?php echo $UpdateTotalGDPEntry-&gt;Fields('island_id'); ?&gt;" /&gt;
&lt;input type="hidden" name="total_gdp_id" value="&lt;?php echo $UpdateTotalGDPEntry-&gt;Fields('total_gdp_id'); ?&gt;" /&gt;
&lt;input type="hidden" name="MM_update" value="form1" /&gt;
&lt;input type="hidden" name="total_gdp_id" /&gt;
&lt;/form&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;?php include('footer.html'); ?&gt; &lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php
$UpdateTotalGDPEntry-&gt;Close();

$GetIslandName-&gt;Close();
?&gt;

</font id=code></pre id=code>

Edited by - TheMaxTor on 25 Nov 2005 22:07:13

Reply to this topic