List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 27 1999 3:46pm
Subject:Re: Weird mySQL Query through perl script
View as plain text  
At 10:31 AM -0400 8/27/99, B.W. McAdams wrote:
>I recently wrote an application (cgi w/ perl) for a client that is for all
>intents and purposes, a modified guestbook.  The date of the post is stored as
>a YYYYMMDD timestamp in my mySQL database and parsed out (via substr() )
>when i
>go to display it.
>
>At the present, all the guestbook entries dump on one page.
>However the client has asked me to change it so that the frontend of the
>script
>is a page of by month links..
>The problem here is that the month breakdown is supposed to be year
>insensitive
>(a post from 1997 or a post from 2007 in August should show up on the august
>page).
>Since the date is settable through a backend admin script [the "guestbook"
>posts are done by the page owner] and isn't set by the date it was posted, the
>script is completely year insensitive in and of itself.
>
>I'd like to setup the bymonth breakdown and keep things insensitive - so
>if the
>client posts an entry and dates it 10 or 15 years ago, it falls in with the
>1999, 2000, 2001 entries, etc..
>
>Anyone have any ideas on how to easily approach this with the mySQL query?
>(not
>too familiar with mySQL's pattern matching - the solution may lay there if
>someone can point me in the right direction..)

Can't you use:

SELECT ...., MONTH(timestamp_column) as m FROM ... ORDER BY m

or something like that?

--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
Weird mySQL Query through perl scriptB.W. McAdams27 Aug
  • music filesA. Brandic27 Aug
    • Re: music filesPaul DuBois27 Aug
      • Re: music filesA. Brandic27 Aug
  • Re: Weird mySQL Query through perl scriptPaul DuBois27 Aug