Here's some skeleton code showing one way (untested, no error checking shown):

        $query = 'SELECT Language FROM whatever';
        $result = mysql_query($query);
        $languages = array();
        while ($row=mysql_fetch_object($result))
                $languages = array_merge($languages, explode('||', $row->Language));

        $languages = array_unique($languages);

--
Jonathan Rosenberg
President & Founder, Tabby's Place
http://www.tabbysplace.org/
 

> -----Original Message-----
> From: Richard Kurth [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, February 01, 2004 9:27 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Pulling unique data from database
> 
> 
>  I am pulling data from a database that list the Language a person
>  speaks. It is in a format like this.
> 
> English||Spanish
> English
> English||Portuguese||Finnish
> English||Japanese||German
> English
> English
> German
> 
> each time it looks at a new record it list all the languages that that
> person speaks with a double pipe in between each language.
> 
> What I need to do is find all the unique languages so I can generate a
> list of languages that do not have any repeats in it. so the 
> list above
> would be   English,Portuguese,Finnish,Japanese,German,Spanish in any
> order
> 
> How would I go about this. I can not change the format of the database
> and there are over 200 people listed in the database.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Reply via email to