amend mysql table column en masse

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

amend mysql table column en masse

Post by inosent1 »

i have a mysql table called 'data' and 2 columns called 'id' and 'name'

there are 100 records where 'id' = "orange"

what i want to do is write some php code that says:

where id="orange" change name to say "hello'"

any ideas greatly appreciated
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: amend mysql table column en masse

Post by Celauran »

You don't need any PHP code to do that; do it directly in MySQL.

Code: Select all

UPDATE `data` SET `name` = 'hello' WHERE `id` = 'orange'
Post Reply