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 Are These Functions Causing MASSIVE Memory Problems? Please Help!
Hi,

I have a script with some options.

I use regex to replace patterns in strings, but

How would I do "Users not logged in since *** delete them"
I know how I would set this up, and delete the user roughly.
I'll create a table called "Use

[PHP HELP] Php order form.
Hello to everyone @ phpfreaks. Im new to this site and hope to learn lots of things here.

Fir

Array becomes unset by itself?
Hi,

I have a bit of experience with PHP but not extensive. It seems I cannot store any items

How can I get my program to read a larger array ??
Hi:

I have this program that reads from an array to do calculations. The array are just t

Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to s

change text color with a jQuery code
Hihow can I change the text in a asp:TextBox to a different color when I start typing using jQuery?I

Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou

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

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

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