I do not understand your first question.
Your query in effect shows duplicates.

To prevent future duplicates, you can do it in two ways:

1. with MySQL:
create a unique index on what should be unique, most likely the email (it
looks like your business logic implies one entry per email)
in fact you would not have this problem if you had defined email as PRIMARY

But you will have to remove the duplicates first - an unpleasant job.
AFAIK, there is no easy way to do it with MySQL (or SQL in general). You
have to do it procedurally by calling the entire table row by row.

2. Procedurally:
validate user data before entry in the DB

----- Original Message -----
From: "Marco Alting" <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 11:47 AM
Subject: [PHP-DB] displaying duplicate records...

> I have a database which allows people to upload info and foto's. There's a
> unique ID field, but some people tend to upload their info more than once
> (its a contest site). What I'm able to do is to see how may duplicates
> are using the following statement:
> $query="SELECT COUNT(*) as cnt, voornaam,achternaam,leeftijd,ID,email FROM
> modellen GROUP BY email HAVING cnt >1";
> But this only gives me numbers. Does anyone know how to display every
> that has multiple duplicate ?
> Or is there an elegant way to stop people from entering their info more
> once?
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to