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...
Did you know?Explore Trending and Topic pages for more stories like this.
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
Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne
What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin
Random date selection
i want to select random date with time(hour+minutes+sec) where date is specified(10/22/2009) and tim
Error Messaging not working
I changed the way my form tells the user of an error. But I can't seem to get it to work properly.
Just wondering what you think about my site
I am new to phpfreaks i just seen this form and thought it would be cool to see what other thought a
How to restrict the display of report variants
Hello All,
I want t know how to restrict the display of report variants.
I mean, whe
Performance impact of cookies
Hi, I was just wondering what impact there would be in terms of performance if you where to set then
Table trouble
i have been reading the forum for a few weeks and decided to join. i like the format and the advice
Needing Youtube thumb nail fix.
I have a script on a site that pulls in you-tube videos,
The problem is, that the thumb nails for
phpmailer class & pop.gmail.com?
Code: <?php
$mail->IsSMTP();
$mail->Host = "pop.gmail.com";