I have records of data with many columns. One of the columns being date & time. Check the sanpshot for view. Now I want to run a query to display data from particular date to particular date. I am writing following code in php but it doesn't work and actually query doesn't work. Second condition in code when nothing is coming in POST works but not vice versa.
https://i.stack.imgur.com/YNZPg.png
$d1=date("d/m/Y", strtotime($_POST['frm']));
$d2=date("d/m/Y", strtotime($_POST['to']));
$query;
if(empty($_POST['frm'])){
if(empty($_POST['to'])){
$query = mysql_query("select * from ordermng where status = '$xno' ", $link);
}
}
else{
$query = mysql_query("select * from ordermng where (status = '$xno') between date = '$d1%' and date = '$d2%' ", $link);
}