MySQL Forums
Forum List  »  Newbie

checking item availability by date
Posted by: civciv03
Date: September 12, 2004 11:46AM

I am building a page to check availability of items for hire before allowing the customer to add the item in their shopping cart.

HIRE_ITEM table holds item_id, hire_no, start_date, end_date information for each hire item in hire agreement.

I have a PHP form which asks users to enter their intended hire period to check which items will be available between those days. So the form data is :

$HTTP_POST-VARS [‘start_date’]

$HTTP_POST-VARS [‘end_date’]

I wrote the following sql query to check if the given end_date prior to hire_item.start_date OR if the given start date after hire_item.end_date

SELECT DISTINCT item_id
FROM hire_item
WHERE hire_item.start_date > $HTTP_POST-VARS [‘end_date’]
OR hire_item.end_date < $HTTP_POST-VARS [‘start_date’]

This doesn't work for various reasons, can anyone help please. I am new to MySQL and need to get this done soon.
Many Thanks
Di.



Options: ReplyQuote


Subject
Written By
Posted
checking item availability by date
September 12, 2004 11:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.