Hello,
I create some search option with drop down list box. search by month is 1 of them. I've a table named orders, suppose LabOrder_No & Log_date. dates are storing in database as yy-mm-dd but im retriving as dd-mm-yy. I will select a month name from list (jan,feb....dec & their values are 01,02...12), click submit button & display the total orders & quantity of that month. to collect total quantity, i wrote a function:
$month = $_POST['month'];
function totalOrders(){
$q = "SELECT LabOrder_No, LogIn_Date FROM orders WHERE LogIn_Date = '$month'";
$r = mysql_query($q);
if($r){
while($data = mysql_fetch_array($r))
$total = $total + count($data['Sl_No']);
echo $total;
}
}
?>
Topal quantity : <?php echo totalOrders();?>
But displaying nothing. Whats wrong with query?