CodeIgniter Forums
STRANGE SQL update error... Help Anyone RESOLVED - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: STRANGE SQL update error... Help Anyone RESOLVED (/showthread.php?tid=1773)



STRANGE SQL update error... Help Anyone RESOLVED - El Forum - 06-26-2007

[eluser]Unknown[/eluser]
Quote: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 'table = '', semetry = 'semetry', polish = 'polish', girdle = '', culet = '', flo' at line 1

UPDATE ss_products_attributes SET diamond = '', carat_weight = '', color = '', fancy_color = '', cut = 'cut', clarity = 'clarity', depth = '', table = '', semetry = 'semetry', polish = 'polish', girdle = '', culet = '', floresence = 'floresence', measurement = '' WHERE products_id = '2'

I keep gitting the error can anyone tell me what maybe the cause

here is the code

Code:
$pd = array(
        
        'diamond' => $_POST['diamond'],
        'carat_weight' => $_POST['carat_weight'],
        'color' => $_POST['color'],
        'fancy_color' => $_POST['fancy_color'],
        'cut' => $_POST['cut'],
        'clarity' => $_POST['clarity'],
        'depth' => $_POST['depth'],
        'table' => $_POST['table'],
        'semetry' => $_POST['semetry'],
        'polish' => $_POST['polish'],
        'girdle' => $_POST['girdle'],
        'culet' => $_POST['culet'],
        'floresence' => $_POST['floresence'],
        'measurement' => $_POST['measurement']
        );
        //$this->gen_db->update_data_set('ss_products_attributes',"products_id = '{$_POST['products_id']}'",$pd);
        $this->db->where("products_id = '{$_POST['products_id']}'");
        $this->db->update('ss_products_attributes', $pd);



STRANGE SQL update error... Help Anyone RESOLVED - El Forum - 06-26-2007

[eluser]rogierb[/eluser]
'TABLE' is a reserved word, so you can't use it.

See http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html for more info on reserved words

So change it to table_1 or something and it will work.


STRANGE SQL update error... Help Anyone RESOLVED - El Forum - 06-26-2007

[eluser]Unknown[/eluser]
Thanks a Mil.... man I need to get some sleep