par
sacco » 07 janv. 2007, 19:29
Bonjour,
le message d'erreur est
Warning: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\wamp\www\journal\recup.php on line 40
Tous les dll sont bien là et les extention bien param dans php.ini
<?php
//Pas de timeout;
set_time_limit (0);
$Log = file("BrightStor.log");
//ouverture BD
$sqldb = new PDO("mysql:host=localhost;dbname=test","root","")
or die ("impossible d'ouvrir bdd !");
$query = "insert into journal
(JDate,JHeure,JInfo1,JInfo2,JInfo3,JInfo4,JInfo5,JInfo6,JInfo7,JInfo8,JInfo9
,JAction) values
(:JDate,:JHeure,:JInfo1,:JInfo2,:JInfo3,:JInfo4,:JInfo5,:JInfo6,:JInfo7,:JIn
fo8,:JInfo9,:JAction)";
$stmt = $sqldb->prepare($query);
foreach ($Log as $ligne)
{
$pos1 = strpos($ligne,"]");
$entete = substr($ligne,1,$pos1-1);
$JAction = substr($ligne,$pos1+2,strlen($ligne)-$pos1);
list($par1,$par2) = explode(' ',$entete);
list($JDate,$JHeure) = explode('-',$par1);
list($m,$j,$a) = explode('/',$JDate);
$JDate = $a.'-'.$m.'-'.$j;
$par2 = substr($par2,1,strlen($par2)-1);
List($i1,$i2,$i3,$i4,$i5,$i6,$i7,$i8,$i9) = explode(',',$par2);
$stmt->bindParam(':JDate',$JDate);
$stmt->bindParam(':JHeure',$JHeure);
$stmt->bindParam(':JInfo1',$i1);
$stmt->bindParam(':JInfo2',$i2);
$stmt->bindParam(':JInfo3',$i3);
$stmt->bindParam(':JInfo4',$i4);
$stmt->bindParam(':JInfo5',$i5);
$stmt->bindParam(':JInfo6',$i6);
$stmt->bindParam(':JInfo7',$i7);
$stmt->bindParam(':JInfo8',$i8);
$stmt->bindParam(':JInfo9',$i9);
$stmt->bindParam(':JAction',$JAction);
$stmt->execute();
}
echo "chargement termine!";
?>
merci d'avance pour info[/code]
Bonjour,
le message d'erreur est
[quote]Warning: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\wamp\www\journal\recup.php on line 40[/quote]
Tous les dll sont bien là et les extention bien param dans php.ini
[php]
<?php
//Pas de timeout;
set_time_limit (0);
$Log = file("BrightStor.log");
//ouverture BD
$sqldb = new PDO("mysql:host=localhost;dbname=test","root","")
or die ("impossible d'ouvrir bdd !");
$query = "insert into journal
(JDate,JHeure,JInfo1,JInfo2,JInfo3,JInfo4,JInfo5,JInfo6,JInfo7,JInfo8,JInfo9
,JAction) values
(:JDate,:JHeure,:JInfo1,:JInfo2,:JInfo3,:JInfo4,:JInfo5,:JInfo6,:JInfo7,:JIn
fo8,:JInfo9,:JAction)";
$stmt = $sqldb->prepare($query);
foreach ($Log as $ligne)
{
$pos1 = strpos($ligne,"]");
$entete = substr($ligne,1,$pos1-1);
$JAction = substr($ligne,$pos1+2,strlen($ligne)-$pos1);
list($par1,$par2) = explode(' ',$entete);
list($JDate,$JHeure) = explode('-',$par1);
list($m,$j,$a) = explode('/',$JDate);
$JDate = $a.'-'.$m.'-'.$j;
$par2 = substr($par2,1,strlen($par2)-1);
List($i1,$i2,$i3,$i4,$i5,$i6,$i7,$i8,$i9) = explode(',',$par2);
$stmt->bindParam(':JDate',$JDate);
$stmt->bindParam(':JHeure',$JHeure);
$stmt->bindParam(':JInfo1',$i1);
$stmt->bindParam(':JInfo2',$i2);
$stmt->bindParam(':JInfo3',$i3);
$stmt->bindParam(':JInfo4',$i4);
$stmt->bindParam(':JInfo5',$i5);
$stmt->bindParam(':JInfo6',$i6);
$stmt->bindParam(':JInfo7',$i7);
$stmt->bindParam(':JInfo8',$i8);
$stmt->bindParam(':JInfo9',$i9);
$stmt->bindParam(':JAction',$JAction);
$stmt->execute();
}
echo "chargement termine!";
?>
[/php]
merci d'avance pour info[/code]