I am working on a project that when the user approves a task (using approve and decline radio button choices), all the database rows with the same task id must be updated. Each task has sub tasks, and I wish to update the sub tasks too, not only the main task. I am unsure how to implement the foreach condition. Here is my code:
foreach( $_POST['task_id'] as $id) {
$ids = $id["pro_id"];
}
$update = "UPDATE tasks SET for_checking = 'no', approved = 'yes' WHERE task_id = $ids";
I know my coding is faulty, sorry for that. I hope someone can help me improve my code. Or someone tell me if there is any other way other than using foreach. Newbie student here. Thanks in advance!