-1

Possible Duplicate:
Import large csv file to mysql database using php

1. I have a .txt file named un.txt in my public_html folder with 4000 usernames arranged like this:

username1,username2,username3,.....

2. and I have a created a table named oldusernames in database members. The table has only one column named oldusers. I'm using MySql.

How can I import all usernames from file un.txt to my database(members) table(oldusernames) in oldusers field using PHP?

Community
  • 1
  • 1
Ifti Mahmud
  • 862
  • 10
  • 15

1 Answers1

1

Steps (remember we shouldn't be expected to write large pieces of code for you):

  1. Load the text file in PHP (look at PHP's file functions)
  2. Split the string into array elements, delimited by a comma (look at PHP's explode function)
  3. Loop through each array element and insert it into the database.

I hope this helps you.

EM-Creations
  • 4,195
  • 4
  • 40
  • 56