ksumner Posted May 14, 2006 Share Posted May 14, 2006 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-09salesagent,email,fname,lname,street,city,state,zip,country,gender,birthdateI 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! Quote Link to comment Share on other sites More sharing options...
AndyB Posted May 14, 2006 Share Posted May 14, 2006 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 Link to comment Share on other sites More sharing options...
ksumner Posted May 14, 2006 Author Share Posted May 14, 2006 [!--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. Quote Link to comment Share on other sites More sharing options...
.josh Posted May 14, 2006 Share Posted May 14, 2006 free condoms? woot! j/ksetup 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.