UPDATE multiple columns, returning an error?
| From: | Halo | Date: | Tue, 22 Apr 2003 08:41:56 +0000 |
| Subject: | UPDATE multiple columns, returning an error? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27247@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
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