Hi All

Thanks for everyones help in trying to get my script to work - I'm learning
fast. But have the following problem:

I am using the following select command for searching a table with regards
to booked villas according to id number:

$sql = "SELECT COUNT(*) as count FROM bookings WHERE '$book_start_date'
BETWEEN booking_start AND booking_end OR '$book_end_date' BETWEEN
booking_start AND booking_end AND villa_id = '$place'";

This counts as far as I believe an displays a "0" if available and "number
of times it occurs" if unavailable.

The problem I have is that still counts the number of entries regardless of
the villa_id number it is given. In other words if I have a villa that is
booked between 2002-04-10 and 2002-004-20 for villa_id 1 and I search using
the same dates (via a FORM) but on villa_id 3 it still comes back and says
that the villas is unavailable. Which of course it is wrong for villa_id 3
(it is villa_id 1 that is booked).

I have tried to find a command (something like IF villa_id =3 THEN count)
but to no avail that would only count if the villa_id matches as well.

Can anyone help

Thanks for your time.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to