Hi, I know very basic scripting but am getting confused with the mysql portion. I need a PHP script to import CSV file into mysql database.
I have a CSV file exported from Excel that contains 5 columns:
userid, firstname, lastname, password in text format which needs to be md5, and email address.
These 5 columns need to be imported into an existing mysql database that already has existing tables and data. I believe it needs something like this:
INSERT INTO table_members SET group_id=5, username= .... and then username needs to come from the csv file.
The row inserted into table_members also needs:
- a uniqueNumber - a random 32 character string, used for session cookies.
- ip_address (just put in 127.0.0.1 is fine)
- date - Unix time stamp correlated to GMT time. (just whatever time is fine, just proper format?)
Then, there are 2 more tables that needs a row for each new member. Using the member_id of the member as reference:
- table_memberd (this table also needs to add from the CSV file the firstname and lastname)
- table_memberh (this table just needs to add row with member_id and no data for the columns in this table)
I'm thinking that when inserting in table_members, that the script gets the last member_id that was used the next new member uses the next member_id.
Hope that makes sense! Help is so much appreciated.
Thanks!
ASKER