Jump to content

Date / Row Display


recbass

Recommended Posts

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
Share on other sites

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.php

You could modify it to work with dates instead of page limits.  So you can make each page a month.
Link to comment
Share on other sites

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 date
etc...
Link to comment
Share on other sites

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
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.