Forum Moderators: coopster

Message Too Old, No Replies

Convert text document to mysql

Text rows into mysql database?

         

alste123

12:35 pm on Jun 1, 2006 (gmt 0)

10+ Year Member



Hi,

I have three million rows in a 150MB text document as so:

AD bixisarri Bixisarri 00 42.4833333 1.4666667
AD canillo Canillo 02 42.5666667 1.6

Respectively: country, city, city, numbers, latitude, longitude

Is it possible to convert that into a mysql dump document, using PHP for example?

Thanks.

dreamcatcher

3:08 pm on Jun 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi alste123,

A couple of things you can look at:

PHP has a function called fgetcsv for importing CSV files, so you may be able to use that:

[us2.php.net...]

Alternatively, look into the MySQL LOAD_DATA function:

[dev.mysql.com...]

dc