<?php
require 'config/db.php';
$id = 32;
$sql = "SELECT b.*,
        c.partner_name as courier_name, c.partner_code as courier_code,
        p.name as pickup_point_name, p.pickup_point_code, p.address as pickup_address, p.phone as pickup_phone, p.city as pickup_city, p.pin as pickup_pin, p.branch_id as branch_id,
        br.branch_name, co.company_name
        FROM tbl_bookings b
        LEFT JOIN tbl_courier_partner c ON b.courier_id = c.id
        LEFT JOIN tbl_pickup_points p ON b.pickup_point_id = p.id
        LEFT JOIN tbl_branch br ON p.branch_id = br.id
        LEFT JOIN tbl_company co ON br.company_id = co.id
        WHERE b.id = :id";
$stmt = $pdo->prepare($sql);
$stmt->execute([':id' => $id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
print_r($row);
