I am an amateur programmer and have recently been facing a challenge.
I am trying to select a data between range of dates but despite numerous attempts have been unsuccessful. Can someone help me with the code of pulling up data between date ranges.
My code is:
<?php $tdate = $_POST['toDate']; $fdate = $_POST['fromDate']; mysql_connect("localhost","user","pass") or die("Couldn't connect!"); mysql_select_db("db_name") or die("Couldn't find db"); $data = mysql_query("SELECT * FROM db_table BETWEEN saledate '$tdate' AND '$fdate' "); $result = mysql_fetch_array($data); if (!$result) { echo "No result"; } else { echo $result; } ?>