par
niko94100 » 07 déc. 2010, 22:28
BONSOIR,
j'ai réussi à faire ce que je voulais sur mon PC et ce soir je rentre sur mon j'adapte ma connection de base ... (juste à mettre "root" en mot de passe)
ET LA CA NE MARCHE PLUS ....
Je ne comprends pas
mon code php:
<?php
$dbh = new PDO('mysql:host=127.0.0.1;dbname=test', 'root', 'root') or die (mysql_error ());
$file = new SplFileObject('licencies.ffn') or die (mysql_error ());
$file->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY) or die (mysql_error ());
$file->setCsvControl('|');
$dbh->exec("TRUNCATE TABLE licences") or die (mysql_error ());
$stmt = $dbh->prepare("INSERT INTO licences (IUF, club, Civilite, Prenom, Nom, in1, Sexe, Nationalite, Naissance, adresse1, adresse2, CP, Ville, Pays, Telephone, in2, Licence, in3, Type_lic, type_lic2, evo_licence, in4, in5, in6, date_lic1, date_lic2, date_lic3, date_lic4, date_lic5, date_lic6, date_lic7, date_lic8) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") or die (mysql_error ());
foreach($file as $row)
{
$stmt->execute($row);
}
?>
MERCIII
BONSOIR,
j'ai réussi à faire ce que je voulais sur mon PC et ce soir je rentre sur mon j'adapte ma connection de base ... (juste à mettre "root" en mot de passe)
ET LA CA NE MARCHE PLUS ....
Je ne comprends pas
mon code php:
[php]<?php
$dbh = new PDO('mysql:host=127.0.0.1;dbname=test', 'root', 'root') or die (mysql_error ());
$file = new SplFileObject('licencies.ffn') or die (mysql_error ());
$file->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY) or die (mysql_error ());
$file->setCsvControl('|');
$dbh->exec("TRUNCATE TABLE licences") or die (mysql_error ());
$stmt = $dbh->prepare("INSERT INTO licences (IUF, club, Civilite, Prenom, Nom, in1, Sexe, Nationalite, Naissance, adresse1, adresse2, CP, Ville, Pays, Telephone, in2, Licence, in3, Type_lic, type_lic2, evo_licence, in4, in5, in6, date_lic1, date_lic2, date_lic3, date_lic4, date_lic5, date_lic6, date_lic7, date_lic8) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") or die (mysql_error ());
foreach($file as $row)
{
$stmt->execute($row);
}
?>[/php]
MERCIII