...

View Full Version : check to see if present



zorro
01-23-2004, 11:06 PM
I have the below code writing the email address (from a form) to a file.

How do I skip this step if the email address already exists?

# WRITE EMAIL ONLY TO CSV
if ($send_type == 'csv' or $send_type == 'emailcsv')
{
$content = "$EmailAddress\n";
@ $write = fopen($csvfile_email,'a');
if (!$write and $senderrors == 'yes')
@mail($recipient,"Form Error",$msg['csverr'],"From: \"Notifier\" <Notifier@domain.com>");
@ flock($write,LOCK_EX);
@ fwrite($write,$content);
@ flock($write,LOCK_UN);
@ fclose($write);
} // end $csvfile_email

Thank anyone for helping!

sweenster
01-27-2004, 01:47 PM
surley the answer would be to search through the csv file to find out if the name exists, and only write the details if it does not.

not sure how to do that as i would normally use a mysql database instead of .csv for this.

Possibly try the fread() command??



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum