CodeIgniter Forums
Unknown column - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Unknown column (/thread-22290.html)



Unknown column - El Forum - 09-03-2009

[eluser]webnology[/eluser]
Hi all,

I'm using the below code to update a table, pretty simple.

Code:
$review_pic_string = '1_' . $new_review_id . $orig_data['upload_data']['file_ext'];

//Update the atg_reviews table with the picture(s)
$this->db->set('pic_1', $review_pic_string , FALSE);
$this->db->where('review_id', $new_review_id);
$this->db->update('atg_reviews');

I get the following error:

A Database Error Occurred
Error Number: 1054
Unknown column '1_341.jpg' in 'field list'
UPDATE `atg_reviews` SET `pic_1` = 1_341.jpg WHERE `review_id` = 341

I can't understand why 1_341.jpg' is consiered a column. Any ideas?

All help appreciated,
M


Unknown column - El Forum - 09-03-2009

[eluser]kgill[/eluser]
re-read the page for db->set in the userguide. You're passing false as the third param which means don't escape things. You're sending a string to a varchar column guess what it needs to have done to it.


Unknown column - El Forum - 09-04-2009

[eluser]webnology[/eluser]
That's it. I should have seen that. SOrry.