Hi everyone! I would be greatfull if I find someone to help solve the issue bellow. I want to insert the updated rows in an other table . How can I proceed with the insertion query?
update is ok but insertion nothing being submitted
if(isset($_POST['hidden_id']))
{
$customer = $_POST['customer'];
$date = $_POST['date'];
$payment_status = $_POST['payment_status'];
$grand_total = $_POST['grand_total'];
$reference_no = $_POST['reference_no'];
$paid = $_POST['paid'];
$id = $_POST['hidden_id'];
for($count = 0; $count < count($id); $count++)
{
$data = array(
':customer' => $customer[$count],
':date' => $date[$count],
':payment_status' => $payment_status[$count],
':grand_total' => $grand_total[$count],
':reference_no' => $reference_no[$count],
':paid' => $paid[$count],
':id' => $id[$count]
);
$query = "
UPDATE sales
SET customer = :customer, date = :date, payment_status = :payment_status, grand_total = :grand_total, reference_no = :reference_no, paid = :paid
WHERE id = :id
";
$query= "(insert into payments(date,paid) values (' $date',' $paid' ))";
$statement = $connect->prepare($query);
$statement->execute($data);
}
}