Jump to content

need help :/ "after date do not show


SkullzY88

Recommended Posts

hey i feel kinda stupid asking this :/ but my mind is completely blank

 

basicaly am creating what is known as fixtures(up coming matches) and i need to set it up so that if fixtures date and time has expired then do not show on page but show all the others.

 

here is what ive got at the moment

 

<?PHP
$fix	=	mysql_query("SELECT * FROM site_fixtures LIMIT 5");
while($show	=	mysql_fetch_array($fix)) {


$dte	= explode(",", $show['date']);

if($dte['0'] == $d.'.'.$m.'.'.$y) { $date = 'Today'; }  elseif($dte['0'] == $t.'.'.$m.'.'.$y) { $date = 'tomorrow' } else { $date = $dte['0']; }

echo '     <tr>
                  <td align="left" class="grey">
			  
			  <img src="images/games/'.$show['game'].'.png" width="16" height="16" border="0" /> '.$show['clan'].' '.$show['type'].' '.$show['date'].'
			  
			  </td>
			  
                </tr>';

}
?>

 

it sounds simple and i probibly know what it is but i really cant figure it out :/ i think my mind is going lol

 

hope you understand this and thanks to any replies really appreciate it

Link to comment
Share on other sites

okay so ive figured it maybe a timstamp i need but am not sure on how exactly it wuld be setup so here is what ive got at the moment

 

<?PHP
$fix	=	mysql_query("SELECT * FROM site_fixtures WHERE TIMESTAMP(date) LIMIT 5");
while($show	=	mysql_fetch_array($fix)) {

$dt = date("d.m.y, g:i a", $show['date']); 

if($dt == date("d.m.y, hh:mm")) { $date = 'Today'; }  elseif($dt == date("d.m.y, hh:mm")+1) { $date = 'tomorrow'; } else { $date = $dte['0']; }

echo '     <tr>
                  <td align="left" class="grey">
			  
			  <img src="images/games/'.$show['game'].'.png" width="16" height="16" border="0" style="float:left"; /> '.$show['clan'].' '.$show['type'].' '.$dt.'
			  
			  </td>
			  
                </tr>';

}
?>

 

am not sure on how the timestamp is sapose to be added but that is what ive got at the moment but it wont show up any data what so ever :/ can anyone help me ?

Link to comment
Share on other sites

got it figured after trying random stuff i ended up with this that works

 

here is the code incase anyone else is looking something simular

 

<?PHP

$today = mktime(date('h'), date('i'), 0, date('m'), date('d'), date('y'));
$fix	=	mysql_query("SELECT * FROM site_fixtures WHERE `date` > '$today' LIMIT 5");
while($show	=	mysql_fetch_array($fix)) {

$dt = date("d.m.y, g:i a", $show['date']); 

if($dt == date("d.m.y, g:i a")) { $date = 'Today'; }  elseif($dt == date("d.m.y, g:i a")+1) { $date = 'tomorrow'; } else { $date = $dte['0']; }

echo '     <tr>
                  <td align="left" class="grey">
			  
			  <img src="images/games/'.$show['game'].'.png" width="16" height="16" border="0" style="float:left"; /> '.$show['clan'].' '.$show['type'].' '.$dt.'
			  
			  </td>
			  
                </tr>';

}
?>

Link to comment
Share on other sites

Hmm. Not sure what you exactly meant.. If I got the picture, you could probably do this:

Store the date using strtotime();

$sql = "SELECT * FROM table WHERE date < " . strtotime("now") . ";");
$query = mysql_query($sql)
while ($result = mysql_fetch_assoc($query)
{
   ...do something
}

You want to retrieve the data w/ the date that has passed already right?  :-\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.