Updating more than 1 field at a time

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Updating more than 1 field at a time

Post by seandisanti » Thu Mar 21, 2013 3:45 pm

There are a few ways to do this. The easiest way is to make 2 arrays, one of the original values, and one of the post values, use array_merge() to mash them together. Then have your update statement just update EVERY field. The ones that didn't change will still be updated with their current value, but that won't hurt anything, and the ones that change will get the new values (as long as you put the arrays in the proper order in your array_merge())

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests