RE: retrieving field names in ascending order

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

 



You can use usort which use yor function to compare the values The syntax is
usort($aaray,function)



And use this function

function cmp($a, $b)
{
   if (strtolower($a) == strtolower($b)) {
       return 0;
   }
   return (strtolower($a) < strtolower($b)) ? -1 : 1; 
}

-----Original Message-----
From: hope [mailto:umeed921@xxxxxxxxx] 
Sent: Saturday, September 10, 2005 7:44 AM
To: php-db@xxxxxxxxxxxxx
Subject: Re:  retrieving field names in ascending order

Well now i m retrieving results into an array

Then i m using sort($myarray)
but the problem is that it sorts in this way
(
e.g. 

ABB          
MBB
ZZZ
abc
def
ztt

)

i.e it sorts capital letters first n then it sorts the small letters

but i want the display to sort in ascending order whether it is
capital or smal lettr.
i want my output to look like this
(
abc
ABB
def
MBB
ztt
ZZZ
)

even if i use parameter

sort($myarray, SORT_ASC);

doesnt help.


Regards

hope


Bastien Koert wrote:

> AFAIK you can't order the

> SHOW COLUMNS from TABLE

> Yo could pass the results to an array and sort it in the array

> Bastien


>>From: umeed921@xxxxxxxxx (hope)
>>To: php-db@xxxxxxxxxxxxx
>>Subject:  retrieving field names in ascending order
>>Date: Thu, 08 Sep 2005 04:23:31 -0400
>>
>>
>>hi
>>
>>how can i retrieve field names from a table(e.g products_attributes) in 
>>ascending order???
>>i need to display each of the fieldnames alongwith its datatype and length

>>on the page.
>>
>>
>>regards hope
>>
>>--
>>PHP Database Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>

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

 
 
****************************************************************************
********
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer
viruses.
****************************************************************************
********

-- 
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