$value) {
$how_many = $data[$key]['how_many'];
$type = $data[$key]['type'];
$discount = $data[$key]['discount'];
for ($i=0; $i < $how_many; $i++) {
mysqli_query(
$db,
"INSERT INTO `tretment_has_custom_discount`(`discount`, `tretment_id`, `services_id`, `inv_from_db_tables_id`, `inv_table_id`, `type_discount_id`, `done_id`, `date_time`, `user_id`, `activation_id`)
VALUES ('$discount','$tretment_id','$key','17', '$last_id', '$type', '1', '$date_time','$admin_id','2')"
);
}
$value_sql .= "('$last_id','$key','$how_many','$discount', '$type', '$date_time','$admin_id','2'),";
}
$value_sql = rtrim($value_sql, ',');
if(!mysqli_query(
$db,
"INSERT INTO `custom_discount_has_services` (`custom_discount_id`, `services_id`, `how_many`, `discount`, `type_discount_id`, `date_time`, `user_id`, `activation_id`)
VALUES $value_sql"
)){
echo "
";
}
} else {
echo "
";
}
echo "
";
} else {
echo "
";
}
?>