Execution

Signaler
-
Bonjour, votre aide svp car apparti de cette ligne( $st->execute(array($codeArts,$stockMinis,$stockAlerts,$modelArts,$codeCategs,$categArts,$localisationArts,$prixAchatArts,$descripArts,$dateAjoutArts,$dateModifArts));
) de mon programme cidessous ,on me dit qu'il y a :Error
exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\SERVERZ\Apache2\htdocs\DEMO\application\access\modArticle.php:53 Stack trace: #0 C:\SERVERZ\Apache2\htdocs\DEMO\application\access\modArticle.php(53): PDOStatement->execute(Array) #1 {main}
<?php
// Recuperation des donnees
$id = $_POST['id'];
$codeArts = $_POST['txtcodeArt'];
//$stockMaxis = $_POST['txtstockMaxi'];
$stockMinis = $_POST['txtstockMini'];
$stockAlerts = $_POST['txtstockAlert'];
$modelArts = $_POST['txtmodelArt'];
$codeCategs = $_POST['txtcodeCateg'];
$categArts = $_POST['txtcategArt'];
$localisationArts= $_POST['txtlocalisationArt'];
$prixAchatArts = $_POST['txtprixAchatArt'];
$descripArts= $_POST['txtdescripArt'];
$dateAjoutArts= $_POST['txtdateAjoutArt'];
$dateModifArts= $_POST['txtdateModifArt'];

// verification des donnees
if($codeArt=$_GET['codeArts']){
$req_maj="SELECT * FROM articles WHERE codeArt=?";
}
elseif(empty($codeArts) || empty($stockMaxis))

{
echo '<script type="texte/javascript"> alert("Erreur de saisie\n reesayer svp");</script>';
// Redirection sur le formulaire de saisie
header('Location: listeArticle.php');
}

//connexion au server de BD
$dsn='mysql:host=localhost;dbname=mypratik';
$user='plko';//Nom d'ulisateur
$pass='okde';

try{

//Definition de la nouvelle connexion
$bdd=new PDO($dsn,$user,$pass);
$bdd->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
// exit;
if($req_maj){
$req_prep=$bdd->prepare($req_maj);
// Execution de la requete prepare
$req_prep->execute(array($codeArt));
//recuperation du resultat
$data=$req_prep->fetch();//print_r($data);
}
else{
// formulation de la requete
$req_insert="UPDATE articles SET id=?,codeArt=?,stockMini=?,stockAlert=?,modelArt=?,codeCateg=?,categArt=?,localisationArt=?, prixAchatArt=?,descripArt=?,datAjoutArt=?,dateModifArt=? WHERE $codeArt=?'";
//Prepation de la requete
$st = $bdd->prepare($req_insert);
// Execution de la requete prepare
$st->execute(array($codeArts,$stockMinis,$stockAlerts,$modelArts,$codeCategs,$categArts,$localisationArts,$prixAchatArts,$descripArts,$dateAjoutArts,$dateModifArts));
// liberation des ressources
$bdd=null;
$st=null;
$msg="Mise a jour reussir";
header('Location: listeArticle.php');
}

}

catch(PDOException $ex)
{
echo "Error <br/>". $ex;
exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body> <!--//disabled="disabled" pour desactiver-->
<?php echo $msg; ?><br/>
<p> <a href="listeArticle.php"> Modifier un autre Article </a></p>

<div>
<p>Gestion des Articles du SMG</p>
<form id="form1" name="form1" method="post" action="../access/modArticle.php">
<fieldset>
<legend>Article</legend>
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td>Code</td>
<td><input type="text" name="txtcodeArt" id="txtcodeArt"value="<?php echo $data['codeArt']; ?>" />
</td>
<td> </td>
</tr>
<tr>
<td>Stock Maxi</td>
<td><input type="text" name="txtstockMaxi" id="txtstockMaxi" value="<?php echo $data['stockMaxi']; ?>" /></td>
</tr>
<tr>
<td>Stock Mini</td>
<td><input type="text" name="txtstockMini" id="txtstockMini" value="<?php echo $data['stockMini']; ?>" /></td>
</tr>
<tr>
<td>Stock Alerte</td>
<td><input type="text" name="txtstockAlert" id="txtstockAlert" value="<?php echo $data['stockAlert']; ?>" /></td>
</tr>
<tr>
<td>modele Article</td>
<td><input type="text" name="txtmodelArt" id="txtmodelArt" value="<?php echo $data['modelArt']; ?>" /></td>
</tr>
<tr>
<td>code Categorie</td>
<td><input type="text" name="txtcodeCateg" id="txtcodeCateg" value="<?php echo $data['codeCateg']; ?>" /></td>
</tr>
<tr>
<td>categorie Article</td>
<td><input type="text" name="txtcategArt" id="txtcategArt" value="<?php echo $data['categArt']; ?>" /></td>
</tr>
<td>localisation Article</td>
<td><input type="text" name="txtlocalisationArt" id="txtlocalisationArt" value="<?php echo $data['localisationArt']; ?>" /></td>
</tr>
<tr>
<td>prixAchat Article</td>
<td><input type="text" name="txtprixAchatArt" id="txtprixAchatArt" value="<?php echo $data['prixAchatArt']; ?>" /></td>
</tr>
<tr>
<td>description Article</td>
<td><input type="text" name="txtdescripArt" id="txtdescripArt" value="<?php echo $data['descripArt']; ?>" /></td>
</tr>
<tr>
<td>datAjout Article</td>
<td><input type="text" name="txtdateAjoutArt" id="txtdateAjoutArt" value="<?php echo $data['datAjoutArt']; ?>" /></td>
</tr>
<tr>
<td>date de Modification Article</td>
<td><input type="text" name="txtdateModifArt" id="txtdateModifArt" value="<?php echo $data['dateModifArt']; ?>" /></td>
</tr>
</table>
<fieldset>
<p>
<input type="reset" name="btnAnnuler" id="button" value="Annuler" />

<input type="submit" name="btnEnregistrer" id="btnEnregistrer" value="Enregistrer" />
</p>
</fieldset>
<p><a href="../access/listeArticle.php">Liste des Articles</a></p>
</form>
</div>

</body>
</html>