I need to update multiple records in a single form but am not sure how to proceed. The following is the code I am using to insert the fields into the database originally.

$case = date(ymdHis);

//register into database
if (!empty($p1_firstname)) mysql_query ("INSERT INTO cases VALUES ('$case','$date_booked','$p1_firstname','$p1_lastname ''$city’)");

if (!empty($p2_firstname)) $register_case = mysql_query ("INSERT INTO cases VALUES ('$case','$date_booked','$p2_firstname','$p2_lastname','$city’)");

I have an update form which displays data for however many records there are for each "case". How can I use UPDATE to edit information in different rows when each row has the same identifier ($case)?

First u set primary key for case table,say like case_id.
For insertion u can use for loop.

On the update form list all the records which may be have same $case value.But different case_id.

Then update records by specifying their case_id value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.