Re: Finding Duplicate Numbers?
| From: | Plutarck | Date: | Tue, 17 Apr 2001 18:41:16 +0000 |
| Subject: | Re: Finding Duplicate Numbers? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49020@lists.php.net to get a copy of this message | ||
Hm...it's not fast, but it should work.
Do a select statement to take out just the phone numbers, then do something
like:
while ($row = mysql_fetch_row($result))
{
$array[] = $row[0];
}
$amount = array_count_values($array);
$imax = sizeof($amount);
for ($i = 0; $i < $imax; $i++)
{
if ($amount[$i] > 1)
{
$copys[] = $amount[$i];
}
}
It ain't pretty, but $copys will be an array filled with the phone numbers
that were entered more than once, so you can do whatever you want with it
other than that.
--
Plutarck
Should be working on something...
...but forgot what it was.
""Devin Atencio"" <dreamboy@aros.net> wrote in message
news:LHENJNKBMEPAHKCFNCHGMEILPKAA.dreamboy@aros.net...
>
> I have a SQL Table that has over 1,000 records and I was wanting
> to write a script that would find duplicate phone numbers and
> then list the duplicate phone numbers. I have been trying to
> think on how to do this but I can't think of a way. Can someone
> please help me on some code I could write to do this?
>
> Thanks in advance.
>
> /'^'\
> ( o o )
> ------------------------------------------oOOO--(_)--OOOo----
> Devin Atencio
> ArosNet Systems Administration .oooO
> EMail: dreamboy@aros.net ( ) Oooo.
> --------------------------------------------\ (----( )-----
> \_) ) /
> (_/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>