0

Hi everyone. I'm new in php and need someone to help my problem.

I have one table name data_transaction, from this table i'm want to search data between two dates that user key in.

Here my code,

$sum = "SELECT * , SUM(trans_charges) FROM data_transaction WHERE Location = 'HA1' AND Description = 'FINANCE' AND date_visit = '$date_start' AND date_visit = '$date_end'" ;

the problem is, i want to display summation of the trans_charges between the above condition.

it display all the summation,without filter the date that user key in

thanks..

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by suresh ma
0

Assuming that date_visit is of date or datetime type you can use the BETWEEN operator in mysql.

... WHERE date_visit BETWEEN '$date_start' AND '$date_end' ...
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.