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 Like 43 Dislike
Previous forums Next forums
Other forums

Why does this file not return file names that start with numbers?
This file returns a list of filenames to help populate a drop down in my form. For some reason it ig

Echoing a Variable from a Object
How do I get a variable from the new User Class to echo out in this clasS?

class MyApp
{

Local file browser with php
Halo..

So this is what i want to create. I have a folder that i share and it has many movies.

User input in to variable
Hi all,

I'm sure this is very easy but I'm having another brain freeze!

At the end of

PHP form help required
Hi all! Apologies in advance for having to message the forum for help. I know you must get a lot of

Taxonomy? Classification? Categorisation?
Not sure if there is a way around this classification problem
I have a supplier who produces

Warning: Cannot modify header information - headers already sent by (output sta
Warning: Cannot modify header information - headers already sent by (output started at /home/praylif

Email "$"
Hello!!

Any PHP guy with a bit of a knowledge in Flash ?

When I send a JPEG from flash

pointer 102 question
I read a book
1
2
3
4
5
6
7
8
9
10
11
12
int main() {

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash