Trouble getting dates within range

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Trouble getting dates within range

Post by someguyhere »

Can anyone tell me if there is something wrong with this statement? It's not outputting anything. In this particular case, the values for the variables are:

$current_date = 2011-01-19
$current_events_end = 2011-01-31

Code: Select all

$query = "SELECT * FROM wp_calendar WHERE event_begin BETWEEN $current_date AND $upcoming_events_end";
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: Trouble getting dates within range

Post by someguyhere »

Solved it:

Code: Select all

$query = "SELECT * FROM wp_calendar WHERE event_begin BETWEEN '$current_date' AND '$upcoming_events_end'";
Post Reply