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
43
Other forums
Script not running properly
Hello Everyone
This is a basic script for posting to a database. I'm not sure why it doesn't work
bit of help needed
Im about to sort out my registration page for my website by customising a "registration" s
script is pulling more then they have....
I have this script for my game where they can change there race. This will cost them 2,500 points. H
Call Screen statement Error
Dear Experts,
is there any setting that needs to be done before creating any dialog progr
Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:
QuoteBlah blah
Blah blah
etc
but when i ech
How to Detect it is public_html or httpdocs?
How to check whether it is cPanel or Plesk?
If it found public_html perform <?php incl
list files from folder, only one for each date
I have many files in a folder and wish to only list one of each date
these are the file names
Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?
here is my code
Pagination
Hi All,
I think I'm finally getting somewhere with pagination!
I can now submit a quer
Simpler method of getting variables from mysql
Hi Guys,
I'm trying to streamline my CMS's code and as I was writing a new page it occured to