SQL can be very concise and a well designed query can save a page of php coding so it pays to use it where you can.
If bookings have several tickets (which seems reasonable) then we need to change the query a little. We need an extra join from booking to ticket and then count the tickets for the booking.
Also we reverse the test to 'ticket count < capacity' so only those events with spare capacity are displayed when selling tickets.
$sql = "SELECT e.event_id , e.description, COUNT(t.*) - e.max_bookings as available FROM
event e INNER JOIN booking b ON e.event_id = b.event_id
INNER JOIN ticket t ON b.booking_id = t.booking_id
GROUP BY e.event_id , e.description
HAVING available > 0";
$result = mysql_query($sql);