Re: UPDATE multiple columns, returning an error?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux