DATEDIFF Question
Posted on
16th Feb 2014 07:03 pm by
admin
First time post, and of course it is a help question.
I am using a WP plug-in to display previous and next games in a season. (Leaguemanager is the plug-in name - Link http://wordpress.org/extend/plugins/leaguemanager/ ). The challenge I am having is that the previous game only displays the first game of the season, not the actual previous game...
The following code is pulled from the shortcode.php file in the lib folder of the plugin.
Here is the code for the next game which works...
$next_matches = $leaguemanager->getMatches("( `home_team` = {$team->id} OR
`away_team` = {$team->id} ) AND DATEDIFF(NOW(), `date`) <= 0");
$next_match = $next_matches[0];
Here is the code for the previous game that pulls the first game of the
season, not the actual previous game.
$prev_matches = $leaguemanager->getMatches("( `home_team` = {$team->id} OR
`away_team` = {$team->id} ) AND DATEDIFF(NOW(), `date`) > 0");
$prev_match = $prev_matches[0];
It's probably something really simple, but I have been ahcking away at this for about 8 hours and I cannot get it to work. On a side note if you swap the "0" for a "1" in this line $prev_match = $prev_matches[0]; it will show the second game of the season.
Thanks
No comments posted yet
Your Answer:
Login to answer
185
43
Other forums
Multiple WHILE loops help
Hi there. I'm writing an application that is pulling and displaying results for real estate listing
count only commas outside parenteses
I have a sql table containing
id - query - query name
the first page contains a drop down men
unexpected T_STRING
error log "[Sat Jan 09 18:27:58 2010] [error] [client 127.0.0.1] PHP Parse error: syntax error
CRM?
I think that's what they're called. Customer Management System? Anyway. Is there any good free ones
ORA-01017: invalid username/password; logon denied
Dear All,
I am facing problem in taken backup from db13 it comes up with the following l
if description does not contain the following words
Hello everyone,
I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa
Multiple upload and Resize
I would like some help on my script I have the for my index.php
////
<html&
elseif help!
OK so I'm new to the site, as well as PHP altogether (Trying my hand at managing an online RPG) and
background color imagefill
Hello
I would like to ask you why I see this square in red color just in my local xampp insta
PHP code for a proxy
I was wondering which function I could use to create an online proxy tool. I was thinking cURL would