Thursday 11 September 2008 8:53:44 am
If you worked directly with MySQL, you could do with something like this: SELECT COUNT(real_id), real_id, duplicate_id
FROM table
GROUP BY duplicate_id
and probably even limit the results to only duplicates. In PHP, I'm not sure if it is fast, but should work: <?php
$IDArray = array(...); // here are all the IDs, including duplicates
$IDCount = array_count_values( $IDArray );
$duplicateArray = array();
foreach( $IDCount as $id => $count )
{
if( $count > 1 )
{
array_push( $duplicateArray, $id );
}
}
$duplicateArray = ... // these are duplicate ids...
?>
http://pl.php.net/manual/pl/function.array-count-values.php
--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu
|