I need to run those 3 queries but only if first one is success
I tried this but first and seccond query return 0 rows affected
And third return 1 rows affected
So if first one is 0 row afected it should not continue to others
I can run from PHP mysqli_query() for every query but I think that's not the best way
START TRANSACTION;
UPDATE history H INNER JOIN sku S ON S.skuID= H.skuID SET H.endTime=NOW(), H.end_phone_lat='1', H.end_phone_lng='2', H.end_lat = S.lat, H.end_lng=S.lng WHERE H.skuID='10' AND S.phone='12345' ORDER by H.historiID desc LIMIT 1;
UPDATE sku SET phone=NULL, onDrive=0, lastRideStart = NULL WHERE skuID ='10' AND phone='12345';
UPDATE users set kredit=kredit-(SELECT ROUND(TIMESTAMPDIFF(SECOND, startTime, endTime)*0.1666666666666667, 0) as kredi FROM history WHERE skuID ='10' AND phone='12345' order by historiID desc LIMIT 1) WHERE phone='12345';
COMMIT;