The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 4 of 4

Thread: Plugin Problem

  1. #1

    Plugin Problem

    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 ). 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 hacking 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 for any help!

  2. #2
    PHP Code:
    $prev_matches $leaguemanager->getMatches("( `home_team` = {$team->id} OR
    `away_team` = 
    {$team->id} ) AND DATEDIFF(NOW(), `date`) > 0  ORDER BY `date` DESC");
    $prev_match $prev_matches[0]; 
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  3. #3
    Thanks for the input, I tried that and here is the PHP error I received:

    [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY `date` ASC' at line 1]
    SELECT `group`, `home_team`, `away_team`, DATE_FORMAT(`date`, '%Y-%m-%d %H:%i') AS date, DATE_FORMAT(`date`, '%e') AS day, DATE_FORMAT(`date`, '%c') AS month, DATE_FORMAT(`date`, '%Y') AS year, DATE_FORMAT(`date`, '%H') AS `hour`, DATE_FORMAT(`date`, '%i') AS `minutes`, `match_day`, `location`, `league_id`, `home_points`, `away_points`, `winner_id`, `loser_id`, `post_id`, `season`, `id`, `custom` FROM wp_leaguemanager_matches WHERE ( `home_team` = 1 OR `away_team` = 1 ) AND DATEDIFF(NOW(), `date`) > 0 ORDER BY `date` DESC ORDER BY `date` ASC

  4. #4
    I got some more advice and this seems to do the trick..
    $prev_match = end($prev_matches);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012