SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I insert a txt document into a mysql table?

    There may be a easy way to do this, but I have not found it. If anyone can help, please do.

    How would I get a comma deliminator database imported into my mysql database?


    Here is an example of my comma database file:


    "GAME","Type","FGA","FGM","Pts","Ast","Tot Reb","Blk Sh","Turn","Recoveries"
    "1 Germantown","Season","18","6","14","1","15","0","5","2"
    "2 Grafton","Season","10","3","8","3","13","4","0","6"


    Here is my table layout:


    CREATE TABLE Stats (
    playerid varchar(30) NOT NULL,
    gameid varchar(30) NOT NULL,
    statentryid int(30) NOT NULL auto_increment,
    bbshotattempts int(30) NOT NULL,
    bbshotsmade int(30) NOT NULL,
    bbpoints int(30) NOT NULL,
    bbrebounds int(30) NOT NULL,
    bbsteals int(30) NOT NULL,
    bbturnovers int(30) NOT NULL,
    bbblockedshots int(30) NOT NULL,
    bbassists int(30) NOT NULL,
    bbadditional text NOT NULL, UNIQUE
    statentryid (statentryid) );


    All I am trying to do is take the data from the txt file and put it into the mysql table

    When I try to use phpmyadmin, I get the following error:

    Error
    MySQL said: The file '/tmp/php4vEOLc' must be in the database directory or be readable by all


    What would be another easy way to take my txt database file and join it with my mysql database? or how can I fix the above problem?

    Thanks ahead of time.


    Jason

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Do you have telnet or SSH access to your server?
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe that I have ssh.

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    In that case, upload your text file to your account then connect by SSH. Run the 'mysql' commandline client program (e.g. mysql -uusername -p dbname) then use MySQL's LOAD DATA INFILE command to import your text file.

    See the MySQL manual at http://www.mysql.com/documentation for information about LOAD DATA INFILE.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

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