i got a page contain few of edit function, such as..
i select the 100 record. Then i can change the "status" - one of the select option. At the same time, i can change the time also. below is the code i used.
<?php
foreach ($_POST['status'] as $status) {
foreach ($status as $status1) {
foreach ($status1 as $status2) {
......my_sql update statement ..
}}}
foreach ($_POST['TIME_START'] as $TIME) {
foreach ($TIME as $TIME1) {
foreach ($TIME1 as $TIME2) {
......my_sql update statement ..
}}}
foreach ($_POST['TIME_END'] as $END) {
foreach ($END as $END1) {
foreach ($END1 as $END2) {
......my_sql update statement ..
}}}
?>
But the problem is when update the records, it was quite slow. i think that it was running the foreach() quite many time then cause it slow.
So any method can make it faster or compile the foreach() ?
thank to any comment.
status, time_start and start_end are three dimensional arrays?
Perhaps you could add the data you get from the select queries to your POST dataset (as hidden fields or something).. then you don't need the select queries.. should save you a lot of time...
Or do the select queries up front, and save them in an array.. instead of requering the db, you could look in the array for the values corresponding with $poin and $ecmHR?
thank for reply. Below is my coding in edit page.
i use ['.$empid.']['.$row[APPLY_DATE].']['.$REC.'] as primary key. That why i need foreach() to get the data.
Or do the select queries up front, and save them in an array.. instead of requering the db, you could look in the array for the values corresponding with $poin and $ecmHR?