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

Please Help my PHP Dating Function.
Hi everyone!

Well here is my code that displays this:

It works wonderful.


Ball movement
I want to move a ball from one point to another and it should hit a group of balls at the other end

Re-Order by ID Number
I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database ass

need Array help
This is what I have to do.
$teamname[1] = "Red Sox"
$teamname[2] = "Gian

Email Processor
I have a few questions so this post will be a larger one! Sorry, but I'm a bit of a PHP newbie so be

Not showing whole name with mail () script
I sent up a simple mail form with the PHP mail() script. One problem is when it sends an email with

check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.

The method delivers er_changed_data.

LSB (PHP 5.3) problem with static value!
hello,

i'm having a problem. static::$text variable gets lost at some point. can someone plea

IIS & NW MII on the same server
Hi,

We're weighing the possibility to run both IIS and MII (NetWeaver) on the same server

Add trigger to UpdatePanel programmatically
Hi,I'm working on a website which uses AJAX and Masterpages. What I have is an AJAX UpdatePanel whi

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