recbass Posted December 15, 2006 Share Posted December 15, 2006 I'm a newbie at PHP and have been trying to teach myself to do certain things. There is one thing I just don't know how to go about doing.I want to set up a script for a band so they can list their upcoming show dates. I want the upcoming dates to appear on the upcoming page, and dates that have passed to display on an archives page. This would also make it so that the upcoming page would seem updated after each show automatically.I have all the coding to add dates, display all dates, edit dates, and etc... I just don't know how to seperate them so they can display on seperate pages. Any ideas? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted December 15, 2006 Share Posted December 15, 2006 So you're looking for like a pagnation script but modify it for a date range?This is a little tutorial in pagnation: http://www.phpfreaks.com/tutorials/43/0.phpYou could modify it to work with dates instead of page limits. So you can make each page a month. Quote Link to comment Share on other sites More sharing options...
recbass Posted December 16, 2006 Author Share Posted December 16, 2006 Thanks for pointing me to that. I'll try to to go through that and see what I can make of it.I was actually hoping to just have one page dedicated to an "Archive" page and have the dates not show anymore on the "Upcoming" page. Myspace actually does this but without the archive page. All the listings are still there in the user admin area, but aren't visible on the display page. I thought there might be an extremely easy way to do it like an if statement.if before today's dateetc... Quote Link to comment Share on other sites More sharing options...
Cagecrawler Posted December 16, 2006 Share Posted December 16, 2006 How are you storing the dates? If it's with MySQL, then you could use this for the 'upcoming' page:[code]<?php$date = date();$query = mysql_query(SELECT * FROM table WHERE date > $date);echo "<h1>Upcoming Tour Dates</h1>";echo "<table border=1>";echo "<tr>";echo "<td>Date</td>";echo "<td>Venue</td>";while($row = mysql_fetch_array($query)) { echo "<tr>"; echo "<td>".$row['date']."</td>"; echo "<td>".$row['venue']."</td>"; echo "</tr>";}echo "</table>";[/code]You can customise it to fit eactly what you need (extra columns etc.) Quote Link to comment Share on other sites More sharing options...
emehrkay Posted December 16, 2006 Share Posted December 16, 2006 when you get around to writing sql statements do thisSELECT * FROM table WHERE your_date_field >= NOW()make sure your_date_field is a DATETIME type Quote Link to comment Share on other sites More sharing options...
recbass Posted December 16, 2006 Author Share Posted December 16, 2006 That worked great. Thanks cagecrawler & emehrkay. 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.