PHP

Simple PHP Program that checks data between two dates using jquery and returns result


Below is the PHP script for returning the result using from and two dates with jquery, using mysql as db.

It pulls all the data present in between teh mentioned from and to dates.

The jquery UI user datepicker it has functionalities like default date and onload show current date.























$from = $_POST["from"];
$to = $_POST["to"];
$timestampfrom = strtotime($from);
$timestampto = strtotime($to);

$con = mysql_connect("localhost","root","");
if (!$con){
die('Could not connect: ' . mysql_error());
}

$dbconn = mysql_select_db("thisdb", $con);
if (!$dbconn)
{
die('Could not connect: ' . mysql_error());
}

$result = mysql_query("select * from tutorialsbag");
//echo $result;
if(isset($from))
{
echo "






";
while($row = mysql_fetch_array($result))
{
$id = $row['Id'] ;
$Course = $row['Course'] ;
$Contact = strtotime($row['Contact']);


if($sd >= $timestampfrom && $ed <= $timestampto){

echo "";
echo "";
echo "";
echo "";

//echo "";
echo "";

}
}
echo "
Id Course Contact
" . $id. "" . $Contact. "" . $Course. " " . date("M d Y h:i:s ",$sd). "
";
}
mysql_close($con);
?>