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
https://forums.phpfreaks.com/topic/143195-solved-query-tomorrow/
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.

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.