<?
session_start();
include('../opendb.php');
function validate($fdate,$tfrom,$tto,$user)
{
 $flag='n';
 $s="select * from followup where followdate='$fdate' and '$tfrom' >=tfrom and '$tfrom' <=tto and user='$user'";

 $re=mysqli_query($db,$s);
 if(mysqli_num_rows($re)>0)
  {$flag='y';  return $flag;}

$re=mysqli_query($db,"select * from followup where followdate='$fdate' and '$tto' >=tfrom and '$tto' <=tto  and user='$user'");
 if(mysqli_num_rows($re)>0)
  {$flag='y'; return $flag;}
 else
  {$flag='n';}

if($flag=='n')
{
$sq="select * from followup where followdate='$fdate' and '$tfrom'<=tfrom and '$tto' >=tfrom  and user='$user'";

 $re2=mysqli_query($db,$sq);
 if(mysqli_num_rows($re2)>0)
  {$flag='y'; return $flag;}
 else
  {$flag='n';}
}

}
?>
