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
getting rid of quotes in strings
sick of trying to deal with them in multiple ways (entering in and taking from database, echoing, ec
Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba
array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I h
php sessions,logouts & the bloomin back button!
Hi All,
I've got a cms that members can log into. When they logout, the session is destroyed,
gettext translates ALWAYS?
I'm using gettext with the new version of XAMPP (5.3.0) on Windows Seven RTM (build 7600)
gettext
get multiple rows
Hi I want to get multiple rows from a db
I am using this for the db query
Code: public
Running External Scripts
I am very new to PHP and am not even sure what I'm asking is possible. I have just installed mediaW
If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and th
Echo Tweaking help!
HI. I would like to have the output of the entered variables repeat forever, but it's stopping at th
Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t