Re: Bulk Insert from text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

>   Could any 1 please help on how to insert using phpMyAdmin??

I haven't used phpMyAdmin in years, but here's how I'd do it in SQL with
my favourite tool (SQLyog)

LOAD DATA LOCAL INFILE 'C:\file_name.txt'
 INTO TABLE tbl_name
  FIELDS TERMINATED BY '\t'
  LINES TERMINATED BY '\n'
 IGNORE 1 LINES
 (col_name1, col_name2, col_name3);

Some things to note.
1) the LOCAL keyword is for a file on YOUR computer.  Remove it if the
file is located on the server.  Many shared hosting packages do not
allow you to use LOCAL.

2) IGNORE 1 LINES assumes your file has column names or similar in the
first line, and ignores them. Remove if the file does not have any, or
increase the number if more than one non-data line at the start.

3) The two TERMINATED clauses define the line as being newline
terminated and fields separated by tabs.  Change these accordingly.  You
may need to add an extra backslash  to escape the backslash for
phpMyAdmin, I do not remember how that works with phpMyAdmin.

--
Niel Archer



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux