On Sat, 19 May 2001, Matt Nigh wrote:

> hi, i'm building a website right now with a shows page on it which will
> scroll horizontally in a window. i have each show listed in a table called
> shows (db is called almavale_board) with the following fields:
> id - bandplaying - venue - date - time - cover - description

you could put the band info in another table and reference them by bandid
or something. this would make it easier to expand, like if you ever wanted
to collect stats on each band (like members, genre, etc.).

i only mention this because i did a calendar of events page a while back
and eventually went to such a format. it is much easier this way because
each event was only listed in the database once. just a thought...

> what i need to do is have the shows listed by date, having the latest date
> listed first. here's the code i have presently:
> [ code snip ]
> oh and the date is in this format : Month-Day-,Year (ex. May 19, 2001)
> if anyone can help me out on this at all (or has any questions about my
> problem), please reply to this post, i'd be very appreciative.

how is the date column defined in mysql... is it a DATE type? ... if so
the date would look something like 2001-05-19 in mysql, and you could use
something like:

   SELECT DATE_FORMAT(date, '%M %d, %Y'), ...
   FROM shows

and mysql would sort and format the date as necessary. like this:

mysql> select DATE_FORMAT(date, '%M %d, %Y') from dates order by date

| DATE_FORMAT(date, '%M %d, %Y')       |
| March 31, 2001                       |
| March 29, 2001                       |
| March 28, 2001                       |
| March 28, 2001                       |
| March 27, 2001                       |
| March 24, 2001                       |

hope this helps... :)

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to