boo_lolly Posted April 20, 2007 Share Posted April 20, 2007 i'm having trouble UPDATEing a column in my table where another column matches a few values. pseudo query explaining what i'm looking for: $sql = " UPDATE my_table SET my_column = '1' WHERE id = ('2', '5', '1', '16') //for each of these rows "; make sense? can someone help me figure this out? i've approached this query many different ways, but to no avail, none of them worked. Quote Link to comment https://forums.phpfreaks.com/topic/47927-solved-updateing-multiple-rows-where-one-column-multiple-values/ Share on other sites More sharing options...
boo_lolly Posted April 20, 2007 Author Share Posted April 20, 2007 i figured it out: $sql = " UPDATE my_table SET column = 'value' WHERE my_id_column IN ('4', '41', '2', '6') "; that worked Quote Link to comment https://forums.phpfreaks.com/topic/47927-solved-updateing-multiple-rows-where-one-column-multiple-values/#findComment-234245 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.