Re: data form file to mysql
| From: | lagodin at mail dot iae dot lt | Date: | Fri, 30 Jun 2000 07:52:57 +0000 |
| Subject: | Re: data form file to mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3986@lists.php.net to get a copy of this message | ||
Bartosz Aninowski <bart@sonik.pl> wrote in message
news:8jhj1s$3qn$1@toye.php.net...
> I have file with e-mail addresses separate by \n.
> Please help me to insert it into database.
> Show example of code.
> Do I have to use:
> $file_array = file($file);
First, in mySQL prompt you should create text field in your table:
alter table table_name add email char(50) not null default '';
or if table is not created:
create table table_name (id int not null auto_increment primary key,email
char
(50) not null default '');
Then, in mySQL prompt you should load data:
load data infile '<path to the file on server>' into table table_name
[fields terminated by '\t'] lines terminated by '\n' [(col_name, ...)];
Read mysql manual for more - chaper 7.16 (if version 3.23.11-alpha)