Advertisement

07.17.2008 at 10:31PM PDT, ID: 23575862
[x]
Attachment Details

CSV file into mysql database using PHP

Asked by ssjo22 in PHP Scripting Language, MySQL Server

Tags: , , ,

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!Start Free Trial
[+][-]07.17.2008 at 11:24PM PDT, ID: 22033217

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, MySQL Server
Tags: php, mysql, csv, import
Sign Up Now!
Solution Provided By: Roonaan
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.18.2008 at 08:24AM PDT, ID: 22036790

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 09:30AM PDT, ID: 22037526

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 09:33AM PDT, ID: 22037559

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 10:26PM PDT, ID: 22041441

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.20.2008 at 09:19AM PDT, ID: 22046139

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 10:22AM PDT, ID: 22046317

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 12:37PM PDT, ID: 22046680

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 12:47PM PDT, ID: 22046710

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 10:11PM PDT, ID: 22048149

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.21.2008 at 12:31AM PDT, ID: 22048524

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 12:52AM PDT, ID: 22048611

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906