Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2009
    Posts
    7

    Exclamation Unanswered: import a csv file into multiple mysql tables

    Is there any way that I can import one .csv file and then distribute its contents into multiple tables?

  2. #2
    Join Date
    Mar 2004
    Posts
    480
    create a temporary table, import your csv there and then update the multiple tables from that.

  3. #3
    Join Date
    Feb 2009
    Posts
    7

    thanks

    Will try that and tell you if I succeed..

  4. #4
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Will try that and tell you if I succeed
    You didn't provide any feedback on your previous thread regarding malnourished children.

  5. #5
    Join Date
    Feb 2009
    Posts
    7
    here's the thing, my csv file has around 150++ columns which would be divided into around 30 tables in mysql..

    i need to use a browse button in the site to import the csv file into mysql..

    i have no idea how i'm going to do it..

    sorry, its really my first time to use mysql and php...

  6. #6
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by mustlovechocolate
    here's the thing, my csv file has around 150++ columns which would be divided into around 30 tables in mysql..

    i need to use a browse button in the site to import the csv file into mysql..

    i have no idea how i'm going to do it..
    You could just set up a "transfer" table with those 150 columns. Then load the CSV data directly into this table and then process the data from there.

    Then for each of the tables in your database that gets it's data from the CSV file you could just insert any new records that appear in the transfer table that you don't already have. You'll probably want to do an update to existing data if their fields have changed.

    Quote Originally Posted by mustlovechocolate
    sorry, its really my first time to use mysql and php
    Could you not use what ever languages you are familiar with rather than trying to implement a new system using tools you're new to?

  7. #7
    Join Date
    Feb 2009
    Posts
    7
    unfortunately, i can't..because its a project for school..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •