Be sure that $from_date and $to_date are having date values in 'YYYY-MM-DD' format (if the column type is date)
Use '".$from_date."' instead of '$from_date'
$query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '".$from_date."' AND '".$to_date."'");
From: azhar <eng.azharul@gmail.com>
To: phpexperts@yahoogroups.com
Sent: Saturday, 30 July 2011 4:41 PM
Subject: [phpXperts] mySQL Query with PHP variable is not working
my query is not working. The Query is
$query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '$from_date' AND '$to_date'");
Please help me.
$query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '$from_date' AND '$to_date'");
Please help me.
__._,_.___
Visit phpXperts website at www.phpxperts.net
.
__,_._,___
No comments:
Post a Comment