I have a php form which contains fields for start date and end date. I have already stored the rows in my mysql database and I would like to display the records within the range of start and end dates. I have a column called tdate of datetime value. My form displays the start and end dates in mm/dd/yyyy but mysql doesn't accept that.
Updated:-
$edate = $_POST['edate'] ?? '';
$sdate = $_POST['sdate'] ?? '';
$endDate = date('Y-m-d', strtotime($edate));
$startDate = date('Y-m-d', strtotime($sdate));
if(isset($_POST['submit'])){
$sql = "SELECT * FROM admin_master_tbl ";
$sql .= "WHERE tdate <= '$endDate' AND ";
$sql .= "tdate >= '$startDate' ";
$result = mysqli_query($conn, $sql);
$output = mysqli_fetch_array($result);
print_r($output); }
Ok now it works on my form!