SQL Date Search Solution> search for dates that are not within the range.
Vocation date: 9-12 to 11-06
This will show how to search for dates that are off if it's not between the search dates.
if you search for 10-01 to 10-30 this person should show up.
###################################################################################
$todaydate=$_POST[search_date]." 12:00:00";
$sdate1=$_POST[search_date1]." 00:00:00";
$sdate2=$_POST[search_date2]." 23:59:00";
// ###################################################################################
// $sql_text="select * from leave_all where status='OK' and ('$todaydate' between date1 and date2 ) order by id desc";
$sql_text="select * from leave_all where status='OK'
and ((date1>='$sdate1' and date2<='$sdate2') || (date1<'$sdate1' and date2>'$sdate2'))
|| ('$_POST[search_date1] 12:00:00' between date1 and date2 )
|| ('$_POST[search_date2] 12:00:00' between date1 and date2 )
order by date1 asc";
if($_POST[search_date1]==$_POST[search_date2]){
$sql_text="select * from leave_all where status='OK'
and ('$_POST[search_date1] 12:00:00' between date1 and date2 )
order by date1 asc";
}
留言