Sauvegarder fichier dans BDD
tariq1
-
le père -
le père -
Bonjour,
je veux sauvegarder les lignes d'un fichier CNM (Email) dans une base de donnes, voici mon
script :
<?php
$connection = mysql_connect('localhost', 'root', '') or die(mysql_error($connection));
$select_db = mysql_select_db('Projet_inkfast', $connection) or die(mysql_error($connection));
$file = file('fichier.CNM');
$data = str_replace("|", "", $file, $j); //for removing ' " ' charactor from string
$i = 0;
for ($i = 0; $i < count($data); $i++) { $content = explode(',', $data[$i]);
$ins = "create table iplocation ( id int not null auto_increment primary key, date_heur timestamp unsigned, source char(30), destination char(30), type char(30), note char(100)) engine = myisam; load data infile 'C:\wamp\www\Projet\fichier.CNM' into table iplocation fields terminated by '|' (@id,@date_heure,@source,@destination,@type,@note) set id = replace(@id,'"','') ,date_heur = replace(@date_heur,'"',''), source = replace(@source,'"',''), destination = replace(@destinatio,'"',''), type = replace(@type,'"',''), note = replace(@note,'"','')";
$result = mysql_query($ins, $connection); } echo "done";
?>
et voila l'erreur :
( ! ) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\Projet\sauvgarder.php on line 8
J'ai pas compris ou ce trouve le défaut, Aidez-moi si vous aviez des idée.
Mercii,
je veux sauvegarder les lignes d'un fichier CNM (Email) dans une base de donnes, voici mon
script :
<?php
$connection = mysql_connect('localhost', 'root', '') or die(mysql_error($connection));
$select_db = mysql_select_db('Projet_inkfast', $connection) or die(mysql_error($connection));
$file = file('fichier.CNM');
$data = str_replace("|", "", $file, $j); //for removing ' " ' charactor from string
$i = 0;
for ($i = 0; $i < count($data); $i++) { $content = explode(',', $data[$i]);
$ins = "create table iplocation ( id int not null auto_increment primary key, date_heur timestamp unsigned, source char(30), destination char(30), type char(30), note char(100)) engine = myisam; load data infile 'C:\wamp\www\Projet\fichier.CNM' into table iplocation fields terminated by '|' (@id,@date_heure,@source,@destination,@type,@note) set id = replace(@id,'"','') ,date_heur = replace(@date_heur,'"',''), source = replace(@source,'"',''), destination = replace(@destinatio,'"',''), type = replace(@type,'"',''), note = replace(@note,'"','')";
$result = mysql_query($ins, $connection); } echo "done";
?>
et voila l'erreur :
( ! ) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\Projet\sauvgarder.php on line 8
J'ai pas compris ou ce trouve le défaut, Aidez-moi si vous aviez des idée.
Mercii,
A voir également:
- Sauvegarder fichier dans BDD
- Fichier bin - Guide
- Fichier epub - Guide
- Fichier rar - Guide
- Comment réduire la taille d'un fichier - Guide
- Fichier .dat - Guide