I have that code
if ($res)
{
$plu_arr = $_POST["plu"];
$il_arr = $_POST["il"];
$op_arr = $_POST["op"];
$row_index = 0;
$row_arr = array();
foreach($plu_arr as $plu_data){
if (isset($il_arr[$row_index]) and !empty($il_arr[$row_index]))
{
$row_arr[] = "('".$plu_data."','".$nrZamowienia."','".$il_arr[$row_index]."','".$op_arr[$row_index]."')";
}
if (isset($il_arr[$row_index]) and empty($il_arr[$row_index]))
{
$row_arr_del[] = "('".$plu_data."','".$nrZamowienia."','".$il_arr[$row_index]."','".$op_arr[$row_index]."')";
}
$row_index++;
}
$ins_qry = "INSERT INTO table1 (plu, nr_order, il, op) VALUES ".implode(", ", $row_arr)." ON DUPLICATE KEY UPDATE ilosc = VALUES(ilosc), opis = VALUES(opis)";
$ins_qry_del = "DELETE FROM table1 WHERE plu = {$plu_data[$row_index]} AND nr_order = {$nrZamowienia}";
$db_ins = $this->__db->execute($ins_qry);
$db_ins = $this->__db->execute($ins_qry_del);
And insert and update work fine. If $il
is deleted in the form, the item enters $ins_qry_dell
and this is where the problem begins because the item does not remove from the table ... Will someone help me choose the right condition to remove from the table?