更新时间:2023-01-23 13:59:00
2007年6月19日星期二23:03:45 + 0200,mantrid< ia ******** @ virgin.netwrote:
On Tue, 19 Jun 2007 23:03:45 +0200, mantrid <ia********@virgin.netwrote:
你好
任何人都可以指出我正确的方向阅读文字
档案
一次
行并将该行上的字段分开并将它们用作数据
INSERT将记录添加到mysql表中。然后阅读
文本文件中的第二行并重复。
Hello
Can anyone point me in the right direction for the way to read a text
file a
line at a time and separate the fields on that line and use them as data
in
an INSERT to add a record to a mysql table. Then read the second line in
text file and repeat.
最坏情况:fgets()& explode()/ split(),但取决于格式
fscanf()甚至伟大的fgetcsv()都可以成为你的朋友。
-
Rik Wasmus
Worst case: fgets() & explode()/split(), but depending on the format
fscanf() or even the great fgetcsv() can be your friends.
--
Rik Wasmus
2007年6月19日星期二23:30:42 +0200,Rik< lu *********** *@hotmail.com写道:
On Tue, 19 Jun 2007 23:30:42 +0200, Rik <lu************@hotmail.comwrote:
2007年6月19日星期二23:03:45 + 0200,mantrid< ia ******** @ virgin .net>
写道:
On Tue, 19 Jun 2007 23:03:45 +0200, mantrid <ia********@virgin.net>
wrote:
>你好
任何人都可以指出我正确的方向阅读文本
一次提交一行,并将该行上的字段分开,并将它们用作INSERT中的数据,以便将记录添加到mysql表中。然后阅读
文本文件中的第二行并重复。
>Hello
Can anyone point me in the right direction for the way to read a text
file a
line at a time and separate the fields on that line and use them as
data in
an INSERT to add a record to a mysql table. Then read the second line in
text file and repeat.
最坏情况:fgets()& explode()/ split(),但取决于格式
fscanf()甚至伟大的fgetcsv()都可以成为你的朋友。
Worst case: fgets() & explode()/split(), but depending on the format
fscanf() or even the great fgetcsv() can be your friends.
哦,如果可能的话:不要低估LOAD DATA的功能
mysql本身的INFILE语法。没有必要在PHP中乱七八糟如果MySQL可以实现它本身就可以实现。
-
Rik Wasmus
Oh, and if it''s possible: do not underestimate the power of LOAD DATA
INFILE syntax of mysql itself. No need to fuss around in PHP if MySQL can
do it practically on it''s own.
--
Rik Wasmus
谢谢rik,
将在明天查看你的建议。
ian
Rik < lu ************ @ hotmail.comwrote in message
news:op.tt6t46t6qnv3q9@metallium ...
thanks rik,
will look into your suggestions tomorrow.
ian
"Rik" <lu************@hotmail.comwrote in message
news:op.tt6t46t6qnv3q9@metallium...
On Tue,2007年6月19日23:30:42 +0200,Rik< lu ************ @ hotmail.com>
On Tue, 19 Jun 2007 23:30:42 +0200, Rik <lu************@hotmail.com>
写道:
wrote:
>
>
2007年6月19日星期二23:03:45 + 0200,mantrid< ia ******** @ virgin.net>
写道:
On Tue, 19 Jun 2007 23:03:45 +0200, mantrid <ia********@virgin.net>
wrote:
你好
任何人都可以指出我正确的方向阅读文本
文件a
一行,并将该行上的字段分开并将它们用作
数据
INSERT将记录添加到mysql表中。然后在
中读取第二行
Hello
Can anyone point me in the right direction for the way to read a text
file a
line at a time and separate the fields on that line and use them as
data in
an INSERT to add a record to a mysql table. Then read the second line
in
文本文件并重复。
text file and repeat.
最坏情况:fgets()& explode()/ split(),但取决于格式
fscanf()甚至伟大的fgetcsv()都可以成为你的朋友。
Worst case: fgets() & explode()/split(), but depending on the format
fscanf() or even the great fgetcsv() can be your friends.
哦,如果可能的话:不要低估LOAD DATA的功能
mysql本身的INFILE语法。没有必要在PHP中乱搞,如果MySQL可以实现它自己做的话。
-
Rik Wasmus
Oh, and if it''s possible: do not underestimate the power of LOAD DATA
INFILE syntax of mysql itself. No need to fuss around in PHP if MySQL can
do it practically on it''s own.
--
Rik Wasmus