SkullzY88 Posted March 12, 2008 Share Posted March 12, 2008 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 Quote Link to comment Share on other sites More sharing options...
SkullzY88 Posted March 13, 2008 Author Share Posted March 13, 2008 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 ? Quote Link to comment Share on other sites More sharing options...
SkullzY88 Posted March 13, 2008 Author Share Posted March 13, 2008 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>'; } ?> Quote Link to comment Share on other sites More sharing options...
dotBz Posted March 13, 2008 Share Posted March 13, 2008 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? :-\ Quote Link to comment Share on other sites More sharing options...
SkullzY88 Posted March 14, 2008 Author Share Posted March 14, 2008 nah i wanted to do if date expired do not show only show date that has not expired but thanks for replying Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.