Current File : /home/inlingua/www/noida/icentex_noida/leave_tracker/js/classaffect_ajax.php |
<?php
session_start();
// Include the database connection details
require('../dbConnection.php');
// Include the table handler class
require('../dbHandler.class.php');
$notshowaffected=1;
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$fromdate=$_GET['fromdate'];
$todate= $_GET['todate'];
$fromDate = $fromdate;
$toDate = $todate;
$dateMonthYearArr = array();
$fromDateTS = strtotime($fromDate);
$toDateTS = strtotime($toDate);
for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) {
// use date() and $currentDateTS to format the dates in between
$currentDateStr = date("Y-m-d",$currentDateTS);
$dateMonthYearArr[] = $currentDateStr;
//print $currentDateStr.�<br />�;
}
//print_r($dateMonthYearArr);
foreach($dateMonthYearArr as $val)
{
$str.="(startdate<='".$val."' AND enddate>='".$val."') || ";
}
//echo $str;
$str1=substr($str, 0, -4); ;
//echo "djdjjdjd \n";
$query="SELECT *
FROM `ingl_course`
WHERE (".$str1.") AND instructor='".$_SESSION[id]."' ";
$result=mysql_query($query);
while($num =mysql_fetch_array($result))
{
$notshowaffected=0;
echo 'Level:'.$num['level'].' - CourseID:'.$num['courseid'].' - Branch:'.$num['branch'].'';
echo " \n\n";
}
if($notshowaffected==1) echo $notshowaffected;
?>