0

hi folks,

my reservation table is as below.

tbl_holiday_booking

booking_id
property_id
checkin_date
checkout date

i am taking checkin and checkout date as dd/mm/yyyy

please hellp me to check availability for the property in the above table.

Thanks

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by network18
0

I guess you will have some bunch of html select elements for the user to select the checkin and the checkout dates.
After the form submit just check all the validation is done properly by the javascript or else some bugs like checkout date>checkin date,
after that select query to check the db and then other processing.
just do

if(isset($_POST['bt']) && $_POST['btn'] !='')
{
//form the dates here
$chkinDay = $_POST['chkinDay_select_name'];
$chkinMonth = $_POST['chkinMonth_select_name'];
$chkinyr = $_POST['chkinYr_select_name'];

$chkoutDay = $_POST['chkoutDay_select_name'];
$chkoutMonth = $_POST['chkoutMonth_select_name'];
$chkoutyr = $_POST['chkoutYr_select_name'];
$sql = mysql_query("select * from tblname where chckindate<='".$yourFormedDate."' and chkoutDate >='".$yourFormedDate"' ");
if(mysql_num_rows($sql) > 0){
//data available do something
while(mysql_fetch_query($sql))
{
//do something with the fetched data
}
}

Edited by network18: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.