<?php
$adate = ''.$_POST['yearstart'].'-'.$_POST['monthstart'].'-'.$_POST['daystart'].'';
$aorders = "SELECT orderno,username,DATE_FORMAT(dateadded, '%d-%m-%Y') AS dateadded,status FROM orders WHERE dateadded='$adate' AND archive='1' ORDER BY dateadded DESC";
$aordersq = mysql_query($aorders, $db_conn) or die("Query orders failed".mysql_error());
?>
how do i get it to search by month and year only? I have tried a few things and can't get it to work.
?>
<?php
$mdate = $_POST['monthstart'];
$ydate = $_POST['yearstart'];
$aorders = "SELECT orderno,username,DATE_FORMAT(dateadded, '%d-%m-%Y') AS dateadded,status FROM orders WHERE MONTH(dateadded)='$mdate' AND YEAR(dateadded)='$ydate' AND archive='1' ORDER BY dateadded DESC";
?>