Hello all,
I am having a little trouble updating a table. Here is how things are setup: I have a table named "rummages" and a table named "customer_rummages". When a record is entered into "rummages", it automatically adds that record to the "customer_rummages" table; the colums are exactly the same in both tables. This works great. Now what I want to do is if someone who wants to update the record, they would update the record via the edit page under the "rummages" table. Now what I would like to do is when they update that record, I would like the same record in the "customer_rummages" table to be updated as well. Here is the script that I have been using in the Events section under "edit page - after record updated":
global $conn;
$strSQLUpdate = "UPDATE customer_rummages set your_name='".$values["your_name"]."';title='".$values["title"]."';start_date='".$values["start_date"]."';end_date='".$values["end_date"]."';date1='".$values["date1"]."';shr1='".$values["sh1"]."';smin1='".$values["smin1"]."';sampm1='".$values["sampm1"]."';ehr1='".$values["ehr1"]."';emin1='".$values["emin1"]."';enampm1='".$values["enampm1"]."';date2='".$values["date2"]."';shr2='".$values["shr2"]."';smin2='".$values["smin2"]."';sampm2='".$values["sampm2"]."';ehr2='".$values["ehr2"]."';emin2='".$values["emin2"]."';eampm2='".$values["eampm2"]."';date3='".$values["date3"]."';shr3='".$values["shr3"]."';smin3='".$values["smin3"]."';sampm3='".$values["sampm3"]."';ehr3='".$values["ehr3"]."';emin3='".$values["emin3"]."';eampm3='".$values["eampm3"]."';date4='".$values["date4"]."';shr4='".$values["shr4"]."';smin4='".$values["smin4"]."';sampm4='".$values["sampm4"]."';ehr4='".$values["ehr4"]."';emin4='".$values["emin4"]."';eampm4='".$values["eampm4"]."';address='".$values["address"]."';direction='".$values["direction"]."';street='".$values["street"]."';street_type='".$values["street_type"]."';city='".$values["city"]."';zip_code='".$values["zip_code"]."';description='".$values["description"]."';web_link='".$values["web_link"]."';refer='".$values["refer"]."'; where rummageid=".$values["rummageid"];
db_exec($strSQLUpdate,$conn);
I get this error when I try updating the record:
php error happened
Technical information
Error type 256
Error description 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 'title='Insert into Database';start_date='2011-04-23';end_date='2011-04-24';date1' at line 1
URL www./rummage/rummages_edit.php?
Error file /home/rummagem/public_html/rummage/include/dbconnection.php
Error line 36
SQL query UPDATE customer_rummages set your_name='Brian';title='Insert into Database';start_date='2011-04-23';end_date='2011-04-24';date1='2011-04-23';shr1='';smin1='15';sampm1='a.m.';ehr1='5';emin1='30';enampm1='p.m.';date2='2011-04-24';shr2='5';smin2='30';sampm2='p.m.';ehr2='6';emin2='30';eampm2='p.m.';date3='';shr3='';smin3='';sampm3='';ehr3='';emin3='';eampm3='';date4='';shr4='';smin4='';sampm4='';ehr4='';emin4='';eampm4='';address='3333';direction='W';street='Howard';street_type='Ave';city='Milwaukee';zip_code='53220';description='Test test test';web_link='';refer='Web Site'; where rummageid=67
PHPRunner 5.3, MYSQL version 5.1.56
Thanks in adavance for any assistance!
Brian