Jump to content

Query with a range


EchoFool

Recommended Posts

I have been searching around to find a simple example of how to make a query with a date range... say like:

 

between november 10th 2007 to january 7th 2008 with in the query...but using the date("Y-m-d H:i:s",time()); format to do it.

 

Though i could not find anything for it, not sure if im just putting long winded words into search boxes which comes up with nothing relevant... has any one got a link for me to see one or could you show me a simple example of how it is done?

 

Thankyou

Link to comment
Share on other sites

Where are you pulling "time" from? It could be as simple as:

 

$result = mysql_query("SELECT * FROM database WHERE date > '2007-11-10' AND date < '2008-01-07'");

 

But it all depends on how you are getting your ranges

Link to comment
Share on other sites

the user inputs the dates to see logs between certain times...

 

When they pickthe dates in the form it puts it into a format :

 

$Start = //user input  format of date("Y-m-d H:i:s",time());

$End = //user input    format of date("Y-m-d H:i:s",time());

 

Then with the 2 variables some how put them into the query.

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.