Jump to content

Archived

This topic is now archived and is closed to further replies.

leedude

Multiple update syntax

Recommended Posts

is there a way i can selectively update columns like i can with the insert command:

update table1 set (page,title,dsc) = (1,"Page 1","This is Page 1") where id = 4;

(this is excluding the id column from the update).
This produces an error, is there a way i can do this like i can insert data:?

insert into table1 (page,title,dsc) values (1,"Page 1","This is Page 1")

plz help.

Share this post


Link to post
Share on other sites
[code]$query = "UPDATE table1 SET (page,title,doc) VALUES('1','Page 1','This is Page 1') where id = '4')";[/code]

Share this post


Link to post
Share on other sites
Really?!? I didn't know that syntax was even possible.

Share this post


Link to post
Share on other sites
or actually not...
It still brings an error.  :-\

And i cant help noticing that there appears to be an extra close-bracket at the end.

Share this post


Link to post
Share on other sites
Well, you can always try the old-fashioned way:

[code]
$query = "UPDATE table1 SET page = '1', title = 'Page 1' , doc = 'This is Page 1' where id = '4'";
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.