Monday, August 1, 2011

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

 

Dear Azar vai,

Plz try this

$query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '".$from_date."' AND '".$to_date."'");


single cote  double cote dot $variable dot double cote single cote => '".$variable."'
--
Saiful Islam
Gazipur, Bangladesh
http://saifulbd.com/



On Tue, Aug 2, 2011 at 11:06 AM, azhar <eng.azharul@gmail.com> wrote:
 

ok, this was my problem---

<?php
$from_date=$_POST['from_year']."-".$_POST['from_month']."-".$_POST['from_day'];
$to_date=$_POST['to_year']."-".$_POST['to_month']."-".$_POST['to_day'];

include('db_variable.php');

class total_summary{

var $total_payment;

public function msa_payment(){
$query=mysql_query("select SUM(payment) as totalPayment from msa_payment WHERE date BETWEEN '$from_date' AND '$to_date'");
$row=mysql_fetch_array($query);

echo $this->total_payment=$row['totalPayment'];

}
}


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

__,_._,___

No comments: