I have two tables 1) live_booking table 2) company_car table
the company car PK is car_id
. there is a field in the booking table with the car_id for a user to input.
The issue is that when the user runs the SQL query it doesnt return any results, if there is no car_id in the booking table, However if the car_id present into the booking table by the user then the SQL query shows all the results.
I would like it that if there is NO car_id in the booking table then the query gets the remaining fields from the booking table and shows the car fields as blank.
$bookingid = $_GET['id'];
$result = mysqli_query($con, "
SELECT
live_booking.booking_id, live_booking.booking_time, live_booking.booking_date, live_booking.id_mobile,live_booking.reservation_time, live_booking.car_id,
company_cars.car_driver, company_cars.car_make, company_cars.car_model,
customer.eu_name
FROM live_booking live_booking
inner join customer customer on customer.id_mobile = live_booking.id_mobile
inner join company_cars company_cars on company_cars.car_id = live_booking.car_id
WHERE booking_id = $bookingid");