Why not "SELECT WHERE date_field<$max_date and
date_field>$min_date" ?
A very god advice for everyone of you who tries to implement PHP for the
where selects:
You can VERY OFTEN leave this job to the DB itself. SQL don't only have
SELECT, UPDATE etc... they all have lots of functions for th
That did the trick.
Thank you
"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Wed, 3 Apr 2002, Alex wrote:
> > I'm trying to write code that will return all records found between
certain
> > dates(e.g. 2001-01-30 through 2002-01-30). I created
Need one more quote (se below)
Of course that's a mysql parse error!!
Mysql dates are -MM-DD.
Do NOT use slashes
$query = "SELECT * FROM table where date >=
\"$year_1-$month_1-$day_1/$year_1\" AND date <=
\"$year_2-$month_2-$day_2\"";
Read the mysql manual concerning dates, formats,
Of course that's a mysql parse error!!
Mysql dates are -MM-DD.
Do NOT use slashes
$query = SELECT * FROM table where date >=
\"$year_1-$month_1-$day_1/$year_1\" AND date <=
\"$year_2-$month_2-$day_2\"";
Read the mysql manual concerning dates, formats, functions
-Original Message-
On Wed, 3 Apr 2002, Alex wrote:
> I'm trying to write code that will return all records found between certain
> dates(e.g. 2001-01-30 through 2002-01-30). I created a html form with pull
> down menus for both dates but when I try to run it I get a parse error and
> can't figure out what's wrong.
>
On Wed, 3 Apr 2002, Alex wrote:
> I'm trying to write code that will return all records found between certain
> dates(e.g. 2001-01-30 through 2002-01-30). I created a html form with pull
> down menus for both dates but when I try to run it I get a parse error and
> can't figure out what's wrong.
Have you tried BETWEEN
$query = SELECT * FROM table where date BETWEEN '$month_1/$day_1/$year_1'
AND
'$month_2/$day_2/$year_2';
Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Email : [EMAIL PROTECTED]
-Original Message-
From: Alex [
7 matches
Mail list logo