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. Link to comment https://forums.phpfreaks.com/topic/30812-date-row-display/ 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. Link to comment https://forums.phpfreaks.com/topic/30812-date-row-display/#findComment-142064 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... Link to comment https://forums.phpfreaks.com/topic/30812-date-row-display/#findComment-142153 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.) Link to comment https://forums.phpfreaks.com/topic/30812-date-row-display/#findComment-142166 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 Link to comment https://forums.phpfreaks.com/topic/30812-date-row-display/#findComment-142168 Share on other sites More sharing options...
recbass Posted December 16, 2006 Author Share Posted December 16, 2006 That worked great. Thanks cagecrawler & emehrkay. Link to comment https://forums.phpfreaks.com/topic/30812-date-row-display/#findComment-142199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.