NIPP, SCOTT V (SBCSI) wrote: > I am trying to populate an array from a MySQL database. I think I > have the code correct to populate the array, but I need to somehow > sort the array eliminating duplicate values. I think I can loop > through the array doing a comparison and building a new array by > discarding the value if it is a duplicate, but I was not sure if > there was a more efficient way of doing this.
You can ask for only unique values to be returned in the database result. Try something like this: $sql = "SELECT UNIQUE username FROM table WHERE where_clause ORDER BY username"; Katie Dewees Web Developer/PHP Programmer [EMAIL PROTECTED] http://www.evans-young.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php