Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check to see if present

    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!

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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??
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •