0

Sir I have this variable

$date="2016-07-18"

I want to get DATA from 2016-07-01 to 2016-07-17.
In other words I want to get DATA of month given in $date (July) but excluding current date (18)

How to write query

$query = "select * from arrival where ........;

Please help

Edited by phphp

2
Contributors
3
Replies
45
Views
1 Year
Discussion Span
Last Post by cereal
0

sir i used this line

$query = "SELECT * FROM `arrival` WHERE `created_at` >= DATE_FORMAT('".$date."' ,'%Y-%m-01') AND `created_at` < '".$date."';";
echo $query;

it says:
SELECT * FROM arrival WHERE created_at >= DATE_FORMAT('2016-07-18' ,'%Y-%m-01') AND created_at < '2016-07-18';ErrorUnknown column 'created_at' in 'where clause'

How to overcome this

2

ErrorUnknown column 'created_at' in 'where clause'
How to overcome this

Replace with the appropriate columns, mine is an example, I don't know your table structure.

Votes + Comments
I'll upvote also coz Sir rproffitt has the best structure of table lol
I'll upvote and share my table has four legs.
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.