RE: Desc question

2002-12-09 Thread Anderson, Alan R
> From: Alex Behrens [mailto:[EMAIL PROTECTED]]
> ...How can I make it so only one form
> selection adds a DESC tag to the query, is this possible?
> 
> I'm using this code:
> 
> $fetch = mysql_query("SELECT * FROM players ORDER BY $var");
> 
> 
> Name
> Position
> Number
> Grade
> 
> I want only the Grade option to use the desc option with the 
> $fetch query.

If you want DESC to go along with grade_num, just put DESC with grade_num:

  Grade

This seems obvious to me, so I must be missing something. :-)

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Desc question

2002-12-08 Thread Jocelyn Fournier
Hi,

if ($var=='grade_num')
  $filter='DESC';
else
  $filter='ASC';

$fetch = mysql_query("SELECT * FROM players ORDER BY $var $filter");

should work.

Regards,
  Jocelyn
- Original Message -
From: "Alex Behrens" <[EMAIL PROTECTED]>
To: "MYSQL" <[EMAIL PROTECTED]>
Sent: Monday, December 09, 2002 12:03 AM
Subject: Desc question


> hey all,
>
> I have a quick question. I'm trying to display a list of players by their
> name, number, position, and grade. Name, number, and position all display
> properly. However, grade (which is sorted grade number) is backwards,
since
> 12th grade is after 11, 10, etc. How can I make it so only one form
> selection adds a DESC tag to the query, is this possible?
>
> I'm using this code:
>
> $fetch = mysql_query("SELECT * FROM players ORDER BY $var");
>
> 
> Name
> Position
> Number
> Grade
>
> I want only the Grade option to use the desc option with the $fetch query.
> can I do this?
>
> -mysql
>
> Thanks!
> 
> -Alex "Big Al" Behrens
> E-mail: [EMAIL PROTECTED]
> Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
> Phone: 651-482-8779
> Cell: 651-329-4187
> Fax: 651-482-1391
> ICQ: 3969599
> Owner of the 3D-Unlimited Network:
> http://www.3d-unlimited.com
> Send News:
> [EMAIL PROTECTED]
>
>
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php