Php Syntax Error
- by Jeff Cameron
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