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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.