RE: Two Column Sort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03 March 2004 17:07, kc68@xxxxxxxxxxx wrote:

> I'm re-raising an issue I never quite resolved which has become more
> critical.  I want to sort a table on two columns.  There are
> about 440
> rows of which about 400 are blank in the first sort column (CBC); the
> other rows show B in that column.  When I use the coding
> below, the two
> column sort takes place but the rows designated B are at the
> bottom of the
> (long) table and I want them at the top.  Neither asc nor desc
> accomplishes this (just reverses the second factor order,
> still at the
> bottom below the blanks).
> 
> Here's the php code for the sort command:
> 
> echo "<td><div align='center'><font size='3'><b>CBC <a
> href='contributions22504.php?sort_field=cbc,
> net_receipts&sort_order=desc'
> target='_self'><font size='2'>Sort</a></b></font></div></td>\n";
> 
> Here's the basic setup that begins the script:
> 
> # get sort order (if any) passed to script
> $sort_field = $_REQUEST['sort_field'];
> if (! $sort_field) {$sort_field = "State";}
> $sort_order = $_REQUEST['sort_order'];
> if (! $sort_order) {$sort_order = "asc";}

Well, your going to need an order phrase that looks like this:

    ORDER BY CBC DESC, NET_RECEIPTS ASC

so you may need a little rethink about how you're passing those arguments.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux