Reputation: 19
I figure my head around for the best possible query to get the actual event with ! query
This is what I have :
$date = date( 'Y-m-d' );
$time = date( 'Gi' );
datasource : http://screencast.com/t/ODthUUpfR
$sql = "SELECT * FROM events WHERE startdate = '" . $date . "' AND stopdate >= '" . $date . "' ORDER BY stopdate ASC";
The problem I have is if the actual date is 2011-09-15 and the time is 600 (06:00)
The event would be still TeamA but with the above query it would return TeamB.
Upvotes: 0
Views: 165
Reputation: 19251
first, you should have these stored in two DATETIME fields... you are making it way more complicated by storing this in 4 fields.
Then you should do a query more like
WHERE $datetime BETWEEN start_datetime AND end_datetime
Upvotes: 2