insert comma separate string into mysql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Gargomel7
Forum Newbie
Posts: 4
Joined: Tue Sep 30, 2003 8:44 am

insert comma separate string into mysql

Post by Gargomel7 »

I have a series of strings that look like this:

MIKE|2411|09:32|3|0|0|0|0|06:13|49:45|00:00|00:00|00:00|9.6|0.0|87.1|3.3|0.0|0.0|0.0|0.1

TERRY|2061|09:03|0|0|2|0|0|00:00|237:32|00:00|04:17|00:00|0.0|10.7|87.5|0.0|0.0|1.6|0.0|02

ANN|2538|09:05|6|0|1|0|0|04:23|34:18|00:00|07:48|00:00|42.4|13.3|37.8|4.8|0.0|1.4|0.0|0.3

i can separate each of the strings by commas, by pipes or anything that would be necessary....

how do i insert them into mysql now?
philippgerard
Forum Newbie
Posts: 6
Joined: Tue Sep 30, 2003 1:17 pm
Contact:

Post by philippgerard »

SQL:

Code: Select all

INSERT INTO table (field) VALUES ('".$string."');
or is there any special thing about that? don't think so. fieldtype: varchar.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

See manual LOAD DATA INFILE (mysql.com).

If you've got phpMyadmin you can set up a LOAD easily without having to write any scripts.
Post Reply