I am writing a simple script to collect email addresses.
I want to collect ALL email addresses, even if they are duplicated.
However, I don't want to add the email address each time. I can identify that the email address is already registered and has an emailcount of 1 (this is in a separate field. The 1 is registered during the first registration)
My fields are:
|id |fname|surname|email |emailcount|
|23|John |Doe |jd@domain.com|1 |
When
jd@domain.com is registered a second time, I want to read the whole line and pick out 'emailcount'.
I can then add 1 to the number and use UPDATE to modify it to the database.
This is the code that I have got up to now:
PHP Code:
if($email != '') {
$qry = "SELECT * FROM bf_users WHERE email='$email'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0) {
$errflag = true;
}
@mysql_free_result($result);
}
else {
die("Query failed");
}
}
if($errflag) {
//#########################################
print "Duplicate email: "$email;
//#########################################
I cannot work out the next php code to achieve this.
I would appreciate any help and advice.
Thanks