BluMess Posted February 21, 2010 Share Posted February 21, 2010 Hey, just a quick question, I can't find it on the net for mysql, do I need to use the UPDATE query more than once if I'm updating all rows with the same value in 1 column? mysql_query("UPDATE comments SET media_id=".$new_id." WHERE media_id=".$game['id']); Basically in my table, I have lots of comments relating to 1 game (with the id in var $game['id']). I'm trying to change all these IDs to a new ID. Will I need to call that query just once to achieve what I want, or will I need to include it in a loop? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/192845-mysql-and-php-updating-rows-with-same-value-quick-question/ Share on other sites More sharing options...
jl5501 Posted February 21, 2010 Share Posted February 21, 2010 That looks like it would work, providing the id is not the primary key of the table Quote Link to comment https://forums.phpfreaks.com/topic/192845-mysql-and-php-updating-rows-with-same-value-quick-question/#findComment-1015790 Share on other sites More sharing options...
BluMess Posted February 22, 2010 Author Share Posted February 22, 2010 thanks you're right! Quote Link to comment https://forums.phpfreaks.com/topic/192845-mysql-and-php-updating-rows-with-same-value-quick-question/#findComment-1016331 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.