Jump to content

[SOLVED] query tomorrow


dadamssg

Recommended Posts

Im trying to set a query to select events that are gonna happen tomorrow...as in always the next day, the whole 24 hr period. i have the code below to query todays events, how can i set that up to query for tomorrow?

 

$quer = "SELECT * FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE() ORDER BY start DESC";	

 

I doubt theres a tomorrow date function like the curdate()...any help would be amazing, thanks

Link to comment
Share on other sites

SELECT * FROM test 
    WHERE DATE(DATE_ADD(CURDATE(), INTERVAL 1 DAY)) BETWEEN DATE(start) AND DATE(end)
    AND eventtype = 'music'
    ORDER BY start DESC

Theoretically this should pull up any events that are still going on / or starting as of tomorrow.  I haven't tested this.  Also, I'm fairly certain adding the DATE() function around the columns and current date is redundant, but perhaps it's necessary to pull the whole day as you said.

 

If that doesn't work, let us know, and be more specific with what results you want to get back.

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.