Re: Sorting an array

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

 



On 2/28/2011 7:52 PM, Ron Piggott wrote:
> 
> I need help to know how to sort the words / phrases in my array.
> 
> Variable name: $words_used
> print_r( $words_used ); Current output: Array ( [187] => Sin [249] => Punished [98] => Sanctuary [596] => Sing [362] => Anointing Oil )
> Desired result: Alphabetical sort: Array ( [362] => Anointing Oil [249] => Punished [98] => Sanctuary [187] => Sin [596] => Sing ) 
> 
> The #âs are the auto_increment value of the word in the mySQL database.  The number is not representative of alphabetical order, but the order it was added to the database.
> 
> Thank you for your assistance.
> 
> Ron
> 
> The Verse of the Day
> âEncouragement from Godâs Wordâ
> http://www.TheVerseOfTheDay.info  
> 

Besides the answer others have pointed you to, I would recommend doing it in mysql?

SELECT * FROM <table> ORDER BY <your_column>;

Check out the syntax for it here.

http://dev.mysql.com/doc/refman/5.0/en/select.html
and
http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html

Jim Lucas

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux