I have made a function where 2 update statements take place:
$result=$connection->query('update appointments set name="'.$name.'",apps_origin="'.$origin.'",staffID="'.$staff.'",startDate="'.$start.'",endDdate="'.$end.'" where apID="'.$id.'"');
$upservice=$connection->query('update appoint_servi_chosen set service_ID="'.$serviceid.'" where app_ID="'.$id.'"');
The purpose is that the second query does not get executed if the first has not been executed successfully.
I am thinking to use transaction here but I have thought of an alternative and I want you to tell me what you think...here is the pseudocode:
What do you think of the above logic as an alternative to using a transaction?
Obviously I am not innovating here but just want to here some opinions.