Jump to content

Archived

This topic is now archived and is closed to further replies.

ksumner

Complicated script needing complex help.

Recommended Posts

Hi guys I am trying to make a php v4 script that takes the following:

ksumner,JohnQ@public.com,John,Public,154 PUBLIC LN FAKE,Kelso,WA,98626,US,F,1981-04-09

salesagent,email,fname,lname,street,city,state,zip,country,gender,birthdate

I have been collecting mailing information on my website for some time now and I have over 3 million contacts in a flat textfile this is very slow to load on my computer and I fear that one day it might not open!

So I have been trying to develop a script to read this TXT file and import all the information into a MySQL database then have some basic search function to pull up contacts by city/state or gender.

Is this possible?

Thanks!

Share this post


Link to post
Share on other sites
Why am I suspicious about a contact list with 3,000,000+ contacts in it? Sure sounds like something a spammer would love to have.

Just to prove your request is legit, would you mind telling us which website you operate that can get 3 million people to sign up for something.

Share this post


Link to post
Share on other sites
[!--quoteo(post=373645:date=May 13 2006, 11:44 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 13 2006, 11:44 PM) [snapback]373645[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Why am I suspicious about a contact list with 3,000,000+ contacts in it? Sure sounds like something a spammer would love to have.

Just to prove your request is legit, would you mind telling us which website you operate that can get 3 million people to sign up for something.
[/quote]

I operate a goverment funded site called [a href=\"http://www.freecondoms.com/\" target=\"_blank\"]http://www.freecondoms.com/[/a]

We ship condoms to people who need them but are to shy or poor to buy them.

Share this post


Link to post
Share on other sites
free condoms? woot! j/k

setup your table with the various columns you need, then look into the file function [a href=\"http://www.php.net/file\" target=\"_blank\"]http://www.php.net/file[/a] for opening and reading the file, and the preg_match function for pulling out each line of info [a href=\"http://www.php.net/preg_match\" target=\"_blank\"]http://www.php.net/preg_match[/a]

I assume that you probably have a lot of that code already in existence, seeing as how that file had to be made somehow, so most of the hard work is probably already done.

so then, all you have to do is run a while loop (while there are lines to be read from the file, that is) and insert a new row into the table. other than the sheer volume of this file, it seems like a pretty straightforward task.

or, you could do it another way:

write a script to reformat your file in such a way to make it sql data friendly (kinda like how you would export your data from phpmyadmin or something) and then just import it directly into the database.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.