Re: UPDATE multiple columns, returning an error?
| From: | Pete Morganic | Date: | Tue, 22 Apr 2003 14:31:58 +0000 |
| Subject: | Re: UPDATE multiple columns, returning an error? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27257@lists.php.net to get a copy of this message | ||
The SQL is cool, the problem is that the DEC column name is also a mysql reserved word, try using the back tick arounf the table name ie
dec.
I would recommend that u change teh column name though ;-)
pete
Halo wrote:
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 Ive tried alsorts of combinations and have found a site with syntax and it is what ive been using but it still doesnt work.. If anyone knows what I maybe doing wrong I would love to know. Cheers UPDATE - used to update a preexisting cell in database UPDATE SET column1 = value1, column2 = value2 WHERE key = X