Having problems modifying an existing MySQL query and every time I try I keep getting parse errors or MySQL warnings/errors. I have looked at previous questions and tried various things but just can't seem to get it right and it must be something simple.
Here is the working query
mysql_query("
SELECT count(list_id) AS counter
FROM bookings
WHERE
'". $date_form . ($i - ($startday + 1)) ."' BETWEEN checkin_date
AND DATE_SUB(checkout_date, INTERVAL 1 DAY)
AND appmt_id = ". mysql_real_escape_string($_POST['appmt_id'])
);
I want to simply add:
AND is_deleted = 0
is_deleted is a field in the table containing either 0 or 1
Have tried with brackets, quotes etc - apologies for the simple question and thanks in advance for any help.