Chris Payne wrote:
Hi there everyone,

I have a database with email addresses from people who sign up for a newsletter on my website. Now, I have a utility i've written where they can save the addresses as a CSV file on their computer if they are logged in and the admin. What I would love to know, is how can I reserve this? What I mean is, if there is a CSV file with a single field (EMail) i'd like to be able to insert the data into the database from a file which would be selected from the admins computers.

I can select a file from the computer no problem, what i'm not sure how to do is to go through the CSV file, and import the EMail addresses into a record of their own (IE: id1,id2,id3 rather than all in 1 row)).

Any help / code tips would be REALLY appreciated :-)

You can use fopen() to open the file and fgetcsv() to read one line at a time and parse for CSV fields.


You could also just use file() and have an array full of the email address that you'd loop through and perform your INSERTs into the database.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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



Reply via email to