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
email CODING Problem
Email coding problem.
I need to send a section of the info to $tf and the same as a Cc to $em
Create comparison matrix?
I want to create a comparison script for forum software and was wondering is there any tutorial or b
Return X values where an ID number doesnt matter
Well as for subject heading, thats the best i could think of.
Currently im having a problem w
image upload, resize THEN submit form
Ok so I have a form that requires the user to upload an image, and then do something with that image
Table colours fail when extra row added
Hey Gurus,
I got a weird problem with formating the colour of a table made in php. Everything
Text to picture Generator
Hello, i have found this script and it works really good^^ But i have one problem, i would like to c
Problems with array
This code is the last lines in an upload script that uploads 4 images at the same time and writes th
Option box to change variable
Hello, i need help by making a script!
I need to write a file with option box, so a dropdown
Login Functionality Working Different on IE
This is an odd one, I have a site which has an admin section. The admin pages unsurprisingly require
simplexml_load_file and rss problem
Hi,
I have a problem parsing an rss feed using simplexml_load_file - this is strange as i hav