Sunday, July 31, 2011

Re: [phpXperts] mySQL Query with PHP variable is not working

 

Hello,

Theirs nothing wrong with your query. Please check your database. Either you may try this

<?php

$query=mysql_query("SELECT SUM(amount) AS AMOUNT FROM tbl_payment WHERE DATE(pay_date) BETWEEN '$start_date' AND '$end_date' ");

$row=mysql_fetch_assoc($query);
 
echo $row['AMOUNT'];

?>

Thanks & Regards, 

Mofizur Rahman Tipu,
Web Application Engineer,
Datacenter Bangladesh,
Cell: +8801744620814, Mail: mofizur@datacenter.com.bd


From: Md.Shoriful Islam Ronju <smronju@gmail.com>
To: phpexperts@yahoogroups.com
Sent: Saturday, July 30, 2011 10:30 PM
Subject: Re: [phpXperts] mySQL Query with PHP variable is not working

 
Try this...

$sql = "select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN {$from_date} AND {$to_date}"

$query=mysql_query($sql);


On Sat, Jul 30, 2011 at 4:41 PM, azhar <eng.azharul@gmail.com> wrote:
$query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '$from_date' AND '$to_date'");



--
:: Md.Shoriful Islam Ronju ::
http://blog.smronju.com


__._,_.___
Recent Activity:
Visit phpXperts website at www.phpxperts.net
.

__,_._,___

No comments: