Php Syntax Error
Posted
by
Jeff Cameron
on Stack Overflow
See other posts from Stack Overflow
or by Jeff Cameron
Published on 2012-10-19T16:40:50Z
Indexed on
2012/10/19
17:01 UTC
Read the original article
Hit count: 151
I'm trying to update a table in php and I keep getting syntax errors.
Here's what I've got:
if (isset($_POST['inspect'])) {
// get gis_id from pole table to update fm_poles
$sql = "select gis_id from poles where pole_number = '".$_GET['polenumber']."'";
$rs = pg_query($sql) or die('Query failed: ' . pg_last_error());
$gisid = $row['gis_id'];
pg_free_result($rs);
// update fm_poles
$sql = "update fm_poles set inspect ='".$_POST['inspect']."',co_date = '".$_POST['co_date']."',size = '".$_POST['size']."',date = ".$_POST['date'].",brand ='".$_POST['brand']."',backspan = ".$_POST['backspan']." WHERE gis_id = ".$gisid."";
print $sql."<BR>\n";
$rs = pg_query($sql) or die('Query failed: ' . pg_last_error());
pg_free_result($rs);
}
This is the error it gives me:
update fm_poles set inspect ='20120208',co_date = '20030710',size = '30-5',date = 0,brand ='test',backspan = 300 WHERE gis_id =
The error message:
Query failed: ERROR: syntax error at end of input at character 129
© Stack Overflow or respective owner