Date and get the next event
Posted: Thu Jul 29, 2004 3:33 pm
feyd | Please use
which produces the following because I have it set for 50 days out.
Up next for the Generals:
Fri Aug 27 PERRY 7:30
Fri Sep 03 at MOUNT VERNON 7:30
Fri Sep 10 LAKE 7:30
I would like it to just produce 1 event, no matter the amount of days I ask it to look in.
Any help I would be thankful. I am sure I will kick it around some more tonight.
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I would like to be able to show the next sporting event. Even if it is 30 days out, or 2 days away.
I have a lot of dated schedules on the site, yet I cant get things to work for the next event. I tried doing Limit 1, but I am sure it does not work due to my date code.
Here is part of the code that needs fixedCode: Select all
<?php
include '../connect.php';
$today=getdate();
//Start from Sunday
if($today > 0){
$start=mktime (0,0,0,date("m") ,date("d"),date("Y"));
}//Create first week
$x = -1;
echo(' <TR height="40" align="center" valign="top"><FONT color="#FFFF00" SIZE="1" FACE="Verdana, Helvetica, Arial">');
while ($x < 50){
if($x==1){
echo('</font></tr>');
}
$check=date("Y-m-d",mktime (0,0,0,date("m",$start) ,date("d",$start)+$x,date("Y",$start)));
$day = date("D M d",mktime (0,0,0,date("m",$start) ,date("d",$start)+$x,date("Y",$start)));
$result = @mysql_query("SELECT ddate ,dheader,dtime,copp,nhome,ncon,iidgender,iidgame,nwooscore,noppscore FROM fbschedule WHERE iidgender=$iidgender and iidtype=$iidtype AND ddate='$check' LIMIT 1");
if (!$result) {
die('<p>Error retrieving data: ' . mysql_error() . '</p>');
}
if (mysql_num_rows($result) > 0) {
$time = mysql_result($result,0,'dtime');
$date = mysql_result($result,0,'ddate');
$copp = mysql_result($result,0,'copp');
$home=mysql_result($result,0,'nhome');
$con=mysql_result($result,0,'ncon');
$woo=mysql_result($result,0,'nwooscore');
$opp=mysql_result($result,0,'noppscore');
$game = mysql_result($result,0,'iidgame');
$dhead = mysql_result($result,0,'dheader');
$res='';
$at='';
$b='';
$bb='';
$c='';
$bg='';
$dh='';
$link='<a href="'.$go.''.$chref.'/games/game_stats.php?iidgame='.$game.'&iidgender='.$game['iidgender'].'&iidtype='.$game['iidtype'].'">';
if($woo > $opp)
{$time='';
$wl='<b>Won</b> <br>';
$res=$woo.' - '.$opp.'<br>';
}else{
if($woo == $opp){
$time=$time.' ';
$wl='';
}else{
$wl='Lost<br>';
$res=$woo.' - '.$opp.'<br>';
$time='';}
if($home ==1){
$at = ' at ';}
else{
$bg = '#CCCCCC';
$b = '<b>';
$bb= '</b>';}
if($dhead ==1){
$dh = ' DH <br>';}
else{
$dh = '';}
if($con==1){
$c='*';}}
echo('<td width="500" valign="top"><font color="#000000" size="2" face="Verdana, Helvetica, Arial">'."$day $dh$at<em>$b$copp$c$bb</em> $time</div></font></td><tr>");
}
$x++;
}
?>Up next for the Generals:
Fri Aug 27 PERRY 7:30
Fri Sep 03 at MOUNT VERNON 7:30
Fri Sep 10 LAKE 7:30
I would like it to just produce 1 event, no matter the amount of days I ask it to look in.
Any help I would be thankful. I am sure I will kick it around some more tonight.
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]