par
equiibriste » 02 mars 2011, 23:54
bonjour, j'ai un soucis, ma page web arrète pas de me renvoyer une erreur lorsque je tente de modifier ma table avec une requête update SQL....
le message d'erreur est le suivant :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\Program Files\xampp\xampplite\htdocs\ludo\ludomax\adherents\act.php:84 Stack trace: #0 C:\Program Files\xampp\xampplite\htdocs\ludo\ludomax\adherents\act.php(84): PDOStatement->execute(Array) #1 {main} thrown in C:\Program Files\xampp\xampplite\htdocs\ludo\ludomax\adherents\act.php on line 84
le bout de code concerné :
<?php //insertion de l'adhérent
$sql="UPDATE adherents
SET nom = :nvnom, tarif = :nvtarif, date_entree = :nvdate_entree, date_radiation = :nvdate_radiation,caution = :nvcaution, date_caution = :nvdate_caution, telephone = :nvtelephone, mail = :nvmail, adresse = :nvadresse, code_postal= : nvcode_postal, ville = :nvville, zone_geographique = :nvzone_geographique,notes = :nvnotes WHERE id= :adid";
$stmt=$pdo->prepare($sql);
$mod_ad= array (
'nvnom' => $_POST['ad_nom'],
'nvtarif' => $_POST['ad_tarif'],
'nvdate_entree' => $_POST['ad_date_entree'],
'nvcaution' => $_POST['ad_caution'],
'nvdate_caution' => $_POST['ad_date_caution'],
'nvdate_radiation' => $_POST['ad_date_radiation'],
'nvtelephone' => $_POST['ad_telephone'],
'nvmail' => $_POST['ad_mail'],
'nvadresse' => $_POST['ad_adresse'],
'nvcode_postal' => $_POST['ad_code_postal'],
'nvville' => $_POST['ad_ville'],
'nvzone_geographique' => $_POST['ad_zone_geographique'],
'nvnotes' => $_POST['ad_notes'],
'adid' => $_POST['ad_id']);
$stmt->execute($mod_ad);
echo 'Adhérent modifié </br>';
?>
merci d'avance à celui qui m'aidera

... parce que là, je pige pas ce qui ne vas pas dans mon code...
bonjour, j'ai un soucis, ma page web arrète pas de me renvoyer une erreur lorsque je tente de modifier ma table avec une requête update SQL....
le message d'erreur est le suivant :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\Program Files\xampp\xampplite\htdocs\ludo\ludomax\adherents\act.php:84 Stack trace: #0 C:\Program Files\xampp\xampplite\htdocs\ludo\ludomax\adherents\act.php(84): PDOStatement->execute(Array) #1 {main} thrown in C:\Program Files\xampp\xampplite\htdocs\ludo\ludomax\adherents\act.php on line 84
le bout de code concerné :
[php]
<?php //insertion de l'adhérent
$sql="UPDATE adherents
SET nom = :nvnom, tarif = :nvtarif, date_entree = :nvdate_entree, date_radiation = :nvdate_radiation,caution = :nvcaution, date_caution = :nvdate_caution, telephone = :nvtelephone, mail = :nvmail, adresse = :nvadresse, code_postal= : nvcode_postal, ville = :nvville, zone_geographique = :nvzone_geographique,notes = :nvnotes WHERE id= :adid";
$stmt=$pdo->prepare($sql);
$mod_ad= array (
'nvnom' => $_POST['ad_nom'],
'nvtarif' => $_POST['ad_tarif'],
'nvdate_entree' => $_POST['ad_date_entree'],
'nvcaution' => $_POST['ad_caution'],
'nvdate_caution' => $_POST['ad_date_caution'],
'nvdate_radiation' => $_POST['ad_date_radiation'],
'nvtelephone' => $_POST['ad_telephone'],
'nvmail' => $_POST['ad_mail'],
'nvadresse' => $_POST['ad_adresse'],
'nvcode_postal' => $_POST['ad_code_postal'],
'nvville' => $_POST['ad_ville'],
'nvzone_geographique' => $_POST['ad_zone_geographique'],
'nvnotes' => $_POST['ad_notes'],
'adid' => $_POST['ad_id']);
$stmt->execute($mod_ad);
echo 'Adhérent modifié </br>';
?>
[/php]
merci d'avance à celui qui m'aidera :)... parce que là, je pige pas ce qui ne vas pas dans mon code...