I have a question about performing multiple updates in a script. I'll try to be as clear as I can. I have a script that displays several records from my database so they can be edited by a user.
I use a do while loop to out put my records to a the page. In the page the user is presented with, they can edit records and then submit the form to update the records that have been changed.
I'm trying to figure out the logic to submit multiple values and update each one from the form and return the page with the updated values. This is very easy with one set of records, but with multiple records on the same form it is a bit tricky. What I have will work for one, but not for many:
//add multiple value handler here.
//if the user has filled the fields, clean up the data
$date = trim($_GET['date']);
$hours = $_GET['hours'];
$shortDesc = trim(ucwords($_GET['shortDesc']));
$client = $_GET['client'];
$project = $_GET['project'];
$category = $_GET['category'];
$billable = $_GET['billable'];
$rush = $_GET['rush'];
$invoice = trim($_GET['invoice']);
$person = $_GET['person'];
$selectId = $_GET['selectId'];
//call db and insert the new records
$dbInsert = DB::connect($dsn);
if(DB::isError($dbInsert)) {
die($dbInsert->getMessage());
}
//insert the records
$input = $dbInsert->query("UPDATE Query");
if(DB::isError($input)) {
die($input->getMessage());
}
I want to know how I can get multiple values from one form and perfom mulitiple updates at once. Any suggestions?