leedude Posted August 7, 2006 Share Posted August 7, 2006 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. Link to comment https://forums.phpfreaks.com/topic/16812-multiple-update-syntax/ Share on other sites More sharing options...
AndyB Posted August 7, 2006 Share Posted August 7, 2006 [code]$query = "UPDATE table1 SET (page,title,doc) VALUES('1','Page 1','This is Page 1') where id = '4')";[/code] Link to comment https://forums.phpfreaks.com/topic/16812-multiple-update-syntax/#findComment-70763 Share on other sites More sharing options...
fenway Posted August 7, 2006 Share Posted August 7, 2006 Really?!? I didn't know that syntax was even possible. Link to comment https://forums.phpfreaks.com/topic/16812-multiple-update-syntax/#findComment-70771 Share on other sites More sharing options...
leedude Posted August 7, 2006 Author Share Posted August 7, 2006 thankyou thankyou thankyou!!!!!!!!!!!!!!!!!!;D ;D ;D ;D ;D ;D ;D ;D Link to comment https://forums.phpfreaks.com/topic/16812-multiple-update-syntax/#findComment-70773 Share on other sites More sharing options...
leedude Posted August 7, 2006 Author Share Posted August 7, 2006 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. Link to comment https://forums.phpfreaks.com/topic/16812-multiple-update-syntax/#findComment-70776 Share on other sites More sharing options...
fenway Posted August 7, 2006 Share Posted August 7, 2006 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] Link to comment https://forums.phpfreaks.com/topic/16812-multiple-update-syntax/#findComment-70788 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.