Location: PHPKode > projects > BaseballNuke > baseballNuke-2.0/blocks/block-NextGame.php
<?php
/*
This file is part of baseballNuke.
Created by Shawn Grimes http://claimid.com/shawn

baseballNuke is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

baseballNuke is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with baseballNuke; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

if (eregi("block-Name_of_Block.php", $PHP_SELF)) {
  Header("Location: index.php");
  die();
}

global $prefix,$dbi,$module_name;

$sqlString= "SELECT defaultTeam FROM ".$prefix."_baseballNuke_settings  WHERE ID=1";
$resultDefaults=sql_query($sqlString,$dbi);
list($defaultTeam)=sql_fetch_row($resultDefaults,$dbi);


$sqlString="SELECT gameID, DATE_FORMAT(gameDate,'%c-%d-%Y') Gdate, "
    ." TIME_FORMAT(gameTime, '%h:%i') Gtime, homeTeam, visitingTeam, field "
    ." FROM ".$prefix."_baseballNuke_schedule WHERE gameDate >= CURDATE() and gameTime >= CURTIME() ORDER BY gameDate ASC, gameTime ASC LIMIT 1";

$resultNextGame=sql_query($sqlString,$dbi);

if (sql_num_rows($resultNextGame,$dbi) > 0) {
  list($gameID, $Gdate, $Gtime, $homeTeam, $visitingTeam, $field)=sql_fetch_row($resultNextGame, $dbi);
  $content.="The next game will be on <a href=modules.php?name=baseballNuke&amp;page=gameResults&view=".$gameID.">$Gdate at $Gtime.  We will be playing ";
  if($homeTeam == $defaultTeam){
    $content.="$visitingTeam ";
  }else{
    $content.="$homeTeam ";
  }
  $content.="</a> at <a href=modules.php?name=baseballNuke&amp;page=directions&field=".str_replace(" ","%20",$field).">$field.</a>  Come and support us!";
}
else{
  $content.="There are no upcoming games.";
 }




?>
Return current item: BaseballNuke