RE: [PHP-DB] UPDATE multiple columns, returning an error?

From: Date: Tue, 22 Apr 2003 10:24:13 +0000
Subject: RE: [PHP-DB] UPDATE multiple columns, returning an error?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27250@lists.php.net to get a copy of this message
> Hi Ive been spending the last day trying to work out why im getting an > error when trying to UPDATE columns in a table. > > heres the update code im using. > > $query="UPDATE software SET title='$ud_title', dec='$un_dec' WHERE > id='$ud_id'"; > $dbResult = mysql_query($query, $dbLink) > or die ("Database Error: " . mysql_error() ); > > if I only update title='$ud_title' it works fine but when I try to update > more than one column it returns this error. > > Database Error: 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 'dec='' WHERE id='1'' at line 1 http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html #Reserved_words DEC is a reserved word. Choose another column name. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.db (#27250) next »