Re: Newbie question re ORDER
On Apr 1, 9:42am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Lanse wrote:
> > Hi all, I'm not a programmer AT ALL, but I've managed to set up a
> > website that uses PHP to query a MySQL database for a very basic
> > output of data. My apologies in advance for any use of incorrect
> > terminology!
>
> > The one thing I still haven't managed is to sort the resulting array
> > according to a predefined list. I have two fields I'd like to sort
> > on, "month_in" (a text field) and "day_in" (number field). I'd like
> > to sort by month (as seen below), and then by day. The example below
> > is my attempt at the solution,based on a Google search for an answer,
> > but it's obviously not working. Any would be GREATLY
> > appreciated!
>
> > Lanse
>
> > $the_query =
> > 'SELECT * FROM `requests`
> > ORDER BY find_in_set(month_in,
> > 'May','June','July','August','September'), `day_in` ASC;
> > $results = mysql_query($the_query, $dbh);
>
> I would think you would be better off having a DATE column and just sort
> by that column.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
Yes, but my html form just has a month input field and a day input
field... it's for selecting from a small, preset group of dates...
|