I'm trying to do an update to a database of several rows at once, all from the same form. I have no problem doing a single row update. When multiple rows are on the same form, only the last row updates, which is logical since if there are identical field names on a form, only the last value would be recognized.
I've done a lot of searching on this, and I think I'm about 90% there, but am a little stuck at get it to 100%
I don't know if it complicates things or not, but the database I'm working with on this project is MSSQL, and I need to call a stored procedure. I'm handling the php coding, not the mssql code, and I'm trying to get this form submission accomplished through php coding and simply looping throug the stored procedure with the multiple row updates.
It is my understanding that on the submitting form, each field should be numbered so that all fields have unique names:
ID1, name1, title1, description1
ID2, name2, title2, description2
Then on the form submission code, the values entered be sent to until there are no more fields to enter.
So let's say the code for a one row submission is as follows:
$query ="Exec Stored_procedure_name_for_update $ID, '$name' , '$title' , '$description' ";
$result = mssql_query($query) or die("couldn't execute query");
What would I have to add so that this query loops through the form results entering each value for each field name? I'm trying to keep this as simple as possilbe. I'm not a newbie, but I'm not an expert either. I can deal with other issues later, right now I'm just trying to get the loop to work.
Thanks!