I have a booking system with two tables. One table for the users (called users) so that the user know if it has booked it or not and another table for the teacher (called bookings) so that the teacher knows which ones has signed up for their class. Below is an example of when a user unbooks a class.
$new_classes_booked=$classes_booked-1;
$sql2 = $con->query("UPDATE users SET $classes_booked='{$new_classes_booked}' where userID='{$User}'");
$sql2 = $con->query("DELETE FROM bookings where user='{$user}' AND id_class='{$id_classs}'");
This system will be used by many users and teachers simultaneously. Given that, is there a more efficient and more secure way to execute this?