1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Load data to Mysql from a file

Discussion in 'PHP' started by dallvic, Aug 24, 2006.

  1. #1
    Hi,

    I'm quite new to PHP, I have a file with all the data I need,if I open it using wordpad of windows, I can see the data there line by line(several columns per line).

    Could you please tell me how to load it into an existing database in mysql, for example mydb?

    Thank you very much.

    Dallvic
     
    dallvic, Aug 24, 2006 IP
  2. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #2
    Can you post the first few lines of it?

    Just curious if its even in SQL format.
     
    aaron_nimocks, Aug 24, 2006 IP
  3. dsr771

    dsr771 Peon

    Messages:
    65
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You might want to take a look at phpmyadmin - perhaps you have this available on your server. It has a feature to import a data file into mysql.

    If you have a file of sql statements, ie 'INSERT INTO xxx", then phpmyadmin will let you upload that file and run it into your database.

    Hope this helps.
     
    dsr771, Aug 24, 2006 IP
  4. dallvic

    dallvic Guest

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the data look like:

    aaa [bbb] /ccc/
    ddd [eee] /fff/

    Thanks.
     
    dallvic, Aug 24, 2006 IP
  5. dallvic

    dallvic Guest

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes, I have phpmyadmin on my server.
    I just found out that I can use this command to load big amount of data:

    LOAD DATA LOCAL INFILE “***.txt” INTO TABLE mydb;

    Thanks.
     
    dallvic, Aug 24, 2006 IP