Re: Check for duplicates
| From: | Daniel Convissor | Date: | Fri, 01 Dec 2000 06:53:45 +0000 |
| Subject: | Re: Check for duplicates | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28169@lists.php.net to get a copy of this message | ||
Hi Brian:
> Hi. I have a database of just over 1200 names and addresses where I know
> there are some duplicates in it. The server seems to choke on the following
> code and I wonder if anyone has any suggestions. I get an "Internal Server
> Error" after processing about 300 MySQL records in this way:
I took a cursory look at your code. I'm confused why you don't do the "find"
in the initial query using a WHERE clause?
Since I haven't taken the time to fully analyze your code, I'm not sure what
it's trying to do. Are you trying to find duplicates? You can use GROUP BY
clause in a query to find them much quicker:
SELECT email, count(*) FROM TableName GROUP BY email;
Or at least you can print out a list of non duplicated users doing this query
and looping through its results, kind of like this:
SELECT email FROM TableName GROUP BY email
....
while ($row = mysql_fetch_array(...)) {
echo "<tr>....</tr>";
}
See you,
--Dan
--
PHP scripts that make your job easier
http://www.analysisandsolutions.com/code/
SQL Solution | Layout Solution | Form Solution
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409