I am trying to update two tables which are tblbooking and tblvehicle upon clicking a button here is my code;
if(isset($_REQUEST['aeid']))
{
$aeid=intval($_GET['aeid']);
$status="1";
$availability="1";
$sql = "UPDATE tblbooking
JOIN tblvehicles
SET tblbooking.Status=:status,
tblvehicles.Availability=:availability
WHERE tblbooking.id=:aeid";
$query = $dbh->prepare($sql);
$query -> bindParam(':status',$status, PDO::PARAM_STR);
$query -> bindParam(':availability',$availability, PDO::PARAM_STR);
$query-> bindParam(':aeid',$aeid, PDO::PARAM_STR);
$query -> execute();
$msg="Success!";
}
I ran the code above and it updated the tblbooking.Status table BUT it updated all tblvehicles.Availability to 1 on tblvehicles table, it should only update the assigned vehicle. I tried editing it but I am not going anywhere.