Expecting this to simple and I'm missing something obvious.
I have 2 tables.
Car:
CarID, dealerID, info1, info2, info3
Enquiries:
enqID, carID, dealerID, info1, info2, info3
and 1 variable to filter with:
$_SESSION['dealerID']
The enquiries are offers for the car someone has submitted, so their email and price etc.
I need to get the details of the Car and the details of the Enquiry/Offer in one query. So select cars where dealerID = session and then the same, but based of them results.
I have tried:
 $query = $db->query
        ("SELECT * 
          FROM cars, enquiries 
          WHERE cars.dealerID     = ".$_SESSION['dealerID']."
          AND  enquiries.dealerID = ".$_SESSION['dealerID']."");
But this just returns all the cars with matching dealerID as the session.
Will I need to do 1 queries and an if loop through the array? So query getting all cars from dealer, then loop through each $row['dealerID'], until I find matches with dealerID in enquiries?
 
     
     
     
    