| Richard Sauve 2004-04-30, 2:32 am |
| Hi,
The script below add twice the same line from de CSV in the DB,
Is there something I am missing...
-------
$link = mysql_connect("localhost","","");
$selection = mysql_select_db("table", $link);
$line = array();
$fclients = fopen("file.csv","r");
while ($line = fgetcsv($fclients, 1500, ",")) {
$name_cie = addslashes(trim($line[0]));
$adress = addslashes(trim($line[1]));
$tel = addslashes(trim($line[3]));
$fax = addslashes(trim($line[4]));
$mail = addslashes(trim($line[5]));
$name = addslashes(trim($line[6]));
$title = addslashes(trim($line[7]));
$site = addslashes(trim($line[8]));
}
$request = "INSERT INTO contact
(name_cie,adress,tel,fax,mail,name,title
,site,description)";
$request .= "VALUES
('$name_cie','$adresse','$tel','$fax','$
mail','$name','$title','$site','$des
cription')";
$result = mysql_query($request) or DIE("Error: " . mysql_error()) ;
-------
Any help would be appreciated.
R. Sauve
|