Help is needed with Date Search
I have searched regarding this issue and have gotten some help from previously posted threads but still cannot get this going and would appreciate it if someone can help me with this.
I would like to implement search by date. So the user would insert the search date in this format: mm/dd/yyyy.
and the search field on the for is called 'search_date';
Any help would highly be appreciated.
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error('CANNOT CONNECT'));
$db = mysql_select_db($dbname, $conn) or die (mysql_error('CANNOT CONNECT TO DB'));
$curdate = date("m-d-Y"); // current date in dd/mm/yyyy
//SEARCH DATE ENTERED BY USER
$search_date = trim($search_date);
$search_date = isset($_GET['search_date']) ? $_GET['search_date'] : $curdate;
// SELECT STATEMENT
$sql = "SELECT * FROM $tblname";
//APPENDING THE BASE QUERY WITH USER SEARCH DATE
$sql .= "WHERE `date_created`=" .$search_date;
$result = mysql_query($sql);
//WHILE LOOP STARTS HERER
while ($rows = mysql_fetch_array($result))
//$date_created being assigned to date_created db column
$date_created = $rows['date_created'];
//DISPLAYING DATE IN FOLLOWING FORMAT
$date_created = date("m \- d \- Y", strtotime($rows['date_created']));
Thanks a lot.