Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Tab Delim list with CR

Posted on 2006-03-28
Medium Priority
Last Modified: 2011-09-20
I am looking for a very simple script that will take files and import them regardless of how many columns they have.  Is this possible?  I need a script that reads data based on the tab delim and carriage return into a MySQL db.  How could I go about this?  Also, as you can see, first two rows to be ignored, since they are just guides.
Sample data:
Admin1_str_code      Country_str_code      Admin1_str_type      Admin1_str_local_type      Admin1_str_name
AA---      AA      (none)      (none)       
AC000      AC      undetermined      undetermined       
AC001      AC      dependency      dependency      Barbuda

Country_str_code      Region_str_code      Country_str_ISO3166_2char_code      Country_str_ISO3166_3Char_code      Country_str_ISO3166_numeric_code      Country_str_type      Country_str_name      Country_str_local_name      Country_str_long_name      Country_str_local_long_name      Country_str_controlling_entity      Country_str_former_name      Country_str_name_abbreviation
AA      CAC      AW      ABW      533      Dependency/Special Sovereignty      Aruba      Aruba      Aruba      Aruba      Netherlands              
AC      CAC      AG      ATG      028      Independent State      Antigua and Barbuda      Antigua and Barbuda      Antigua and Barbuda      Antigua and Barbuda                     
AE      MEa      AE      ARE      784      Independent State      United Arab Emirates      United Arab Emirates      United Arab Emirates      Al Imarat al Arabiyah al Muttahidah             Trucial Oman, Trucial States      UAE

Thanks in advance.
Question by:lamerhooDJV
  • 2

Author Comment

ID: 16314492
Sorry, didn't specify, the mysql server in quesiton is fairly older so I don't think that would work :(
LVL 33

Accepted Solution

snoyes_jw earned 1500 total points
ID: 16314559
How old is it?  LOAD DATA INFILE has existed at least as far back as version 3.23.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question