I want to take all the records from my MySQL table and check if there are duplicates. I had the idea of storing them all in an array and then checking the array for duplicates. The problem is, I have about 1.5 million rows in my MySQL table.
This is my code so far:
<?php
$con = mysql_connect('localhost', 'root', '');
$sel = mysql_select_db('usraccts', $con);
$users = array();
$q = "SELECT usrname FROM `users`";
$r = mysql_query($q, $con);
while($row = mysql_fetch_assoc($r))
{
$users[] = $row['usrname'];
}
print_r($emails);
?>
I'm not sure how I can adapt this to check for duplicates in the array entries, especially with 1.5 million of them :|
Thanks for any help.