I am tried to read the data from two table but when i tested my php code in postman I got an error.
Here is my php code:
<?php
require_once 'connect.php';
$id = $_POST['id'];
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
die();
}
$stmt = $conn->prepare("SELECT b.reference_no,b.pickup_date,b.pickup_time,b.rental_hour,b.dropoff_date,b.dropoff_time,v.vehicle_brand,v.vehicles_model,v.vehicle_cc,v.vehicle_transmission FROM booking b INNER JOIN vehicles v ON b.plate_number=v.plate_number WHERE id='$id';");
$stmt->execute();
$stmt->bind_result($reference_no,$pickup_date,$pickup_time,$rental_hour,$dropoff_date,$dropoff_time,$vehicle_brand,$vehicle_model,$vehicle_cc,$vehicle_transmission);
$history = array();
while($stmt->fetch()){
$temp = array();
$temp['reference_no'] = $reference_no;
$temp['pickup_date'] = $pickup_date;
$temp['pickup_time'] = $pickup_time;
$temp['rental_hour'] = $rental_hour;
$temp['dropoff_date'] = $dropoff_date;
$temp['dropoff_time'] = $dropoff_time;
$temp['vehicle_brand'] = $vehicle_brand;
$temp['vehicle_model'] = $vehicle_model;
$temp['vehicle_cc'] = $vehicle_cc;
$temp['vehicle_transmission'] = $vehicle_transmission;
array_push($history, $temp);
}
echo json_encode($history);
?>
The error that I got is in this line
$stmt->execute ();