Jump to content

Date range query not working


maxelct

Recommended Posts

Hi

 

I have a database that stores dates as yyyy-mm-dd and I need to query it using yyyy

I noticed that the field where this date is stored is of type char(10) - which looks odd to me....

 

The uers puts in $dateInput and I added 01.01 and 12.31 to the yyyy like this:

 

$lowDate = $dateInput.'-01-01';

$highDate = $dateInput.'-12-31';

 

 

and so get this query:

 

.... WHERE table.field BETWEEN 2000-01-01 AND 2000-12-13

 

if ($result) shows ture but the query provides no returns which I know it should because i have looked at the data.

 

Could anybody please help me. Is it something to do with the field type or am I doing something wrong with the query?

 

thanks

 

E

Link to comment
https://forums.phpfreaks.com/topic/133338-date-range-query-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.