Welcome Guest, Not a member yet? Register   Sign In
Active record question
#5

[eluser]Jason Tan Boon Teck[/eluser]
I'm trying to build an insert statement, using set. For example, in the model:

Code:
...
if(isset($data_array['contact_type'])){$this->db->set('contact_type', $data_array['contact_type']);}
if(isset($data_array['start_date'])){$this->db->set('start_date', $data_array['start_date']);}
if(isset($data_array['contact_address'])){$this->db->set('address', $data_array['contact_address']);}
...

And this is the result

Code:
A Database Error Occurred

Error Number:

ERROR: syntax error at or near "Jalan" LINE 1: ...011120001193888406, 'Residence', 2007-11-01, 3258 Jalan 18/3... ^

INSERT INTO "contact_info" ("contact_id", "person_id", "contact_type", "start_date", "address", "address_2", "address_3", "town", "state", "postcode", "tel_home", "tel_office", "tel_mobile", "fax_no", "email", "synch_out")
VALUES (1267089875, 13051946011120001193888406, 'Residence', 2007-11-01, 3258 Jalan 18/37, Kampung Cempaka, , Petaling Jaya, Selangor, 46000, 03-42563733, , 012-2281996, , , 1148691352)

Somehow, some string values were not composed inside quotes, e.g. address, address_2, causing PostgreSQL to choke. What is the proper way to ensure each string item is in quotes?


Messages In This Thread
Active record question - by El Forum - 02-04-2010, 03:37 PM
Active record question - by El Forum - 02-04-2010, 04:06 PM
Active record question - by El Forum - 02-04-2010, 04:15 PM
Active record question - by El Forum - 02-04-2010, 04:18 PM
Active record question - by El Forum - 02-25-2010, 03:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB