I have made a function where 2 update statements take place:
The purpose is that the second query does not get executed if the first has not been executed successfully.Code:
$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.'"');
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?Code:
Obviously I am not innovating here but just want to here some opinions.