When I loop through key_m array to insert records through my custom $sql statement
if I select 2 records it is INSERT-ing 2 times (2 loops)
if I select 3 records it is INSERT-ing 3 times (3 loops)
After testing, I realized that Row_Updating is looping 2 times already
then I also loop again through key_m which is why 2 records are duplicated and becomes 4 records.
Example
Row_Updating
//only 2 records are selected for multi-update
foreach (Post("key_m") as $key) {
$result .= $key . ","; //customer_id
//execute SQL INSERT
}
$this->setMessage("result = " . $result);
setMessage toast message shows:
result = 223,224,
result = 223,224, // duplicate loop
How can I stop looping 2 times?