Updating multiple rows in mysql
your problem likely lies in the php code, something about constructing variables and looping (i'm guessing -- i don't do php so i only gave your code a cursory glance) however, since you asked this question in the mysql forum, let me give you a mysql answer redesign your table, normalize it to first normal form you have repeating columns in answer One, answer Two, answer Three these should be three rows in a normalized table from there, the php will be slightly different Hello r937! To address your normalization suggestion, here is my table structure (it goes into a tiny bit more detail; my first example was a very generalized one, this one is also generalized to a certain extent) - and there is a specific reason why I have designed it so...which I will explain in a bit.// Users Only take the survey 'foobar' once, and can // edit the answers if and only if they have not completed the survey.
We are well expertise with PHP CRUD operations by accessing My SQL via PHP logic.
The ELSE case will let us keep the original value if we don’t explicitly provide one.
The WHERE will limit our updates to the rows we are trying to update.
Unfortunately it’s not as easy as inserting, but once you see what’s being done you will probably say “Oh, of course! The key to the multiple row update query is the CASE statement.
My SQL’s CASE reference page doesn’t even have the word “UPDATE” on the page anywhere, but don’t let that fool you, it can be used in UPDATE statements!
table_member ( member_id, taking Foobar, foobar Completed, foobar Start Time, foobar End Time ) //foobar is actually a "results" table.