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
help, header() is not working!
Hello, I have this code:
<?php
/**
* @author samoi
* @copyright 200
PayPal Redirect Issue
When I have my paypal button set so that is redirects to http://empiremarketing.ca/order.php,it work
weeks in a year
hi,
i found this snippet on php.net
QuoteFor the week number for weeks starting on Sunday:
upload photo limits
ive got a upload photo script and im just trying to make more secure currently it limits size and as
array_combine() error
getting an "Warning: array_combine() [function.array-combine]: Both parameters should have an e
Help with captcha script needed
Hello,
I am working on a script where reCAPTCHA or a similar form of CAPTCHA will be used, f
ORA-01017: invalid username/password; logon denied
Dear All,
I am facing problem in taken backup from db13 it comes up with the following l
LIMIT $start, 10... how to pass last value queried into next page with GET??
Ok I know how to display the first or last 10 results of a query...
$result = mysql_query(&q
Problem writing URL into database
How would I write this into the database?
<?php echo "http://".$_SERVER['SER
Collecting AOL Search Terms
I am attempting to collect AOL search terms. I know the code is correct (it works for google, bing,