[PHP-DB] Delete duplications from a mysql-resultset

2003-02-22 Thread André Sannerholt
I know the SELECT DISTINCT function. But I need to delete duplications from
the finished resultset. Is that in any way possible? The result-set is not
like an usual array, is it? I've tried the unique_array function, but it
didn't work.

André Sannerholt



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



RE: [PHP-DB] Delete duplications from a mysql-resultset

2003-02-22 Thread John W. Holmes
 I know the SELECT DISTINCT function. But I need to delete duplications
 from
 the finished resultset. Is that in any way possible? The result-set is
not
 like an usual array, is it? I've tried the unique_array function, but
it
 didn't work.

You have to add the result set into an array, first. 

Loop through your result and add each element into an array. Then you
should be able to use array_unique on the resulting array. 

It's a huge waste of time, though, just do it in your query. If you need
both result sets, then just issue two queries. Benchmark, though, to
make sure whatever you're using is the fastest. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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