Forum Moderators: coopster
**********************************************
Hi, I am a web designer, now learning PHP. I just
finished up a site using PHP but now I'm trying to
figure out how to get all this data into the database.
Right now I'm simply working with two columns,
loginName and password. The tablename is Member. There
a bit over 100 rows of data so upload seems to be the
only reasonable way to input the data. For testing
purposes I have a text file that reads...
JoshZiman<tab>josh123
(JoshZiman being in the loginName and josh123 as the
password)
Your book, PHP MySQL for Dummies, says to use the SQL
query:
LOAD DATA LOCAL INFILE "pets" INTO TABLE Pet;
My text file is named test.txt and table name is
Member
What would the query be? I have tried a million things
to replace "pets" like test.txt ,
C:\WINDOWS\Profiles\Josh\My Documents\test.txt nothing
is working.
There is also the link on the phpMyAdmin that reads
"Insert data from a textfile into table" I click it
and get a form that looks like attachment1. Please
tell me how I am filling it out wrong because after I
submit, the data that is submitted ends up having
"JoshZiman josh123" in the loginName field.
Any ideas for either method?
Thanks in advance, Josh Ziman
[edited by: coopster at 11:50 pm (utc) on April 16, 2005]
[edit reason] no solicitations [webmasterworld.com] please [/edit]
If I understand you right, you want to import the contents of a text file that has approx. 100 user names and passwords into you newly created database?
If this is the case it appears you are correct in the format you are using with phpMyAdmin, but you need to set up your text file to be read correctly:
What are your user-names and passwords separated with?
What do your lines end with?
What designates an new row in you database?
If you look at the import options they should allow you to define these identifiers. Choose the ones you are using, or would like to use, then make sure they are in the text file exactly as you have them defined in the import settings.
You should then be able to choose 'browse' or set the path to the file you would like to use manually. (If you can't upload to the DB directly from you desktop, you can always ftp the file to your site and use that path for the import.)
Hope this helps.
Justin
PS No cash accepted, even if it works.