par
JAG11 » 18 mars 2021, 20:47
Bonjour
En tant que débutant, je me permets de poser encore un problème.
Je fais une mise d'une BDD MySQL au travers d'un formulaire avec comme méthode, la méthode POST
Je renvoi donc tous les données à mon fichier maj.php dont voici le code.
Code : Tout sélectionner
<?php
include("../Include/head.html");
include("../connect.php");
include("../Include/NavFede.html");
echo '<pre>';
print_r($_POST);
echo '</pre>';
$Id_Type_Assos = strip_tags($_POST['Id_Type_Assos']);
$Id_Assos_Mere = strip_tags($_POST['Id_Assos_Mere']);
$Nom_Assos = strip_tags($_POST['Nom_Assos']);
$Nom_Court = strip_tags($_POST['Nom_Court']);
$Email = strip_tags($_POST['Email']);
$Telephone = strip_tags($_POST['Telephone']);
$Facebook = strip_tags($_POST['Facebook']);
$WEB = strip_tags($_POST['WEB']);
$Adresse = strip_tags($_POST['Adresse']);
$Complement = strip_tags($_POST['Complement']);
$Ville = strip_tags($_POST['Ville']);
$Code_Postal = strip_tags($_POST['Code_Postal']);
$CotiJoueur = strip_tags($_POST['CotiJoueur']);
$CotiFamille = strip_tags($_POST['CotiFamille']);
$NbMembres = strip_tags($_POST['NbMembres']);
$sql3 = "UPDATE `t_associations`
SET `Id_Type_Assos`=:Id_Type_Assos, `Id_Assos_Mere`=:Id_Assos_Mere, `Nom_Assos`=:Nom_Assos,`Nom_Court`=:Nom_Court,`Email`=:Email,`Telephone`=:Telephone,`Facebook`=:Facebook,`WEB`=:WEB,`Adresse`=:Adresse,`Complement`=:Complement,`Ville`=:Ville,`Code_Postal`=:Code_Postal,`CotiJoueur`=:CotiJoueur,`CotiFamille`=:CotiFamille,`NbMembres`=:NbMembres,`Logo`=:Logo,`Logo_Reduit`=:Logo_Reduit
WHERE `Id_Assos`=:Id_Assos;";
$pdoStat = $db->prepare($sql3);
$pdoStat->bindValue(':Id_Type_Assos', $Id_Type_Assos, PDO::PARAM_INT);
$pdoStat->bindValue(':Id_Assos_Mere', $Id_Assos_Mere, PDO::PARAM_INT);
$pdoStat->bindValue(':Nom_Assos', $Nom_Assos, PDO::PARAM_STR);
$pdoStat->bindValue(':Nom_Court', $Nom_Court, PDO::PARAM_STR);
$pdoStat->bindValue(':Email', $Email, PDO::PARAM_STR);
$pdoStat->bindValue(':Telephone', $Telephone, PDO::PARAM_STR);
$pdoStat->bindValue(':Facebook', $Facebook, PDO::PARAM_STR);
$pdoStat->bindValue(':WEB', $WEB, PDO::PARAM_STR);
$pdoStat->bindValue(':Adresse', $Adresse, PDO::PARAM_STR);
$pdoStat->bindValue(':Complement', $Complement, PDO::PARAM_STR);
$pdoStat->bindValue(':Ville', $Ville, PDO::PARAM_STR);
$pdoStat->bindValue(':Code_Postal', $Code_Postal, PDO::PARAM_STR);
$pdoStat->bindValue(':CotiJoueur', $CotiJoueur, PDO::PARAM_STR);
$pdoStat->bindValue(':CotiFamille', $CotiFamille, PDO::PARAM_STR);
$pdoStat->bindValue(':NbMembres', $NbMembres, PDO::PARAM_INT);
$pdoStat->execute();
echo '<pre>';
print_r($pdoStat);
echo '</pre>';
include("../close.php");
exit;
La ligne
(line 53) provoque un bug avec comme message
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in E:\FFMO\F_Entite\maj.php on line 53
Call Stack
Soit en Français:
PDOStatement :: execute () s'attend à ce que le paramètre 1 soit un tableau, chaîne donnée dans E: \ FFMO \ F_Entite \ maj.php à la ligne 51
Merci de bien vouloir m'aider encore une fois
Bonjour
En tant que débutant, je me permets de poser encore un problème.
Je fais une mise d'une BDD MySQL au travers d'un formulaire avec comme méthode, la méthode POST
Je renvoi donc tous les données à mon fichier maj.php dont voici le code.
[code]
<?php
include("../Include/head.html");
include("../connect.php");
include("../Include/NavFede.html");
echo '<pre>';
print_r($_POST);
echo '</pre>';
$Id_Type_Assos = strip_tags($_POST['Id_Type_Assos']);
$Id_Assos_Mere = strip_tags($_POST['Id_Assos_Mere']);
$Nom_Assos = strip_tags($_POST['Nom_Assos']);
$Nom_Court = strip_tags($_POST['Nom_Court']);
$Email = strip_tags($_POST['Email']);
$Telephone = strip_tags($_POST['Telephone']);
$Facebook = strip_tags($_POST['Facebook']);
$WEB = strip_tags($_POST['WEB']);
$Adresse = strip_tags($_POST['Adresse']);
$Complement = strip_tags($_POST['Complement']);
$Ville = strip_tags($_POST['Ville']);
$Code_Postal = strip_tags($_POST['Code_Postal']);
$CotiJoueur = strip_tags($_POST['CotiJoueur']);
$CotiFamille = strip_tags($_POST['CotiFamille']);
$NbMembres = strip_tags($_POST['NbMembres']);
$sql3 = "UPDATE `t_associations`
SET `Id_Type_Assos`=:Id_Type_Assos, `Id_Assos_Mere`=:Id_Assos_Mere, `Nom_Assos`=:Nom_Assos,`Nom_Court`=:Nom_Court,`Email`=:Email,`Telephone`=:Telephone,`Facebook`=:Facebook,`WEB`=:WEB,`Adresse`=:Adresse,`Complement`=:Complement,`Ville`=:Ville,`Code_Postal`=:Code_Postal,`CotiJoueur`=:CotiJoueur,`CotiFamille`=:CotiFamille,`NbMembres`=:NbMembres,`Logo`=:Logo,`Logo_Reduit`=:Logo_Reduit
WHERE `Id_Assos`=:Id_Assos;";
$pdoStat = $db->prepare($sql3);
$pdoStat->bindValue(':Id_Type_Assos', $Id_Type_Assos, PDO::PARAM_INT);
$pdoStat->bindValue(':Id_Assos_Mere', $Id_Assos_Mere, PDO::PARAM_INT);
$pdoStat->bindValue(':Nom_Assos', $Nom_Assos, PDO::PARAM_STR);
$pdoStat->bindValue(':Nom_Court', $Nom_Court, PDO::PARAM_STR);
$pdoStat->bindValue(':Email', $Email, PDO::PARAM_STR);
$pdoStat->bindValue(':Telephone', $Telephone, PDO::PARAM_STR);
$pdoStat->bindValue(':Facebook', $Facebook, PDO::PARAM_STR);
$pdoStat->bindValue(':WEB', $WEB, PDO::PARAM_STR);
$pdoStat->bindValue(':Adresse', $Adresse, PDO::PARAM_STR);
$pdoStat->bindValue(':Complement', $Complement, PDO::PARAM_STR);
$pdoStat->bindValue(':Ville', $Ville, PDO::PARAM_STR);
$pdoStat->bindValue(':Code_Postal', $Code_Postal, PDO::PARAM_STR);
$pdoStat->bindValue(':CotiJoueur', $CotiJoueur, PDO::PARAM_STR);
$pdoStat->bindValue(':CotiFamille', $CotiFamille, PDO::PARAM_STR);
$pdoStat->bindValue(':NbMembres', $NbMembres, PDO::PARAM_INT);
$pdoStat->execute();
echo '<pre>';
print_r($pdoStat);
echo '</pre>';
include("../close.php");
exit;
[/code]
La ligne [code]$pdoStat->execute();[/code] (line 53) provoque un bug avec comme message
[quote] Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in E:\FFMO\F_Entite\maj.php on line 53
Call Stack[/quote]
Soit en Français: [quote] PDOStatement :: execute () s'attend à ce que le paramètre 1 soit un tableau, chaîne donnée dans E: \ FFMO \ F_Entite \ maj.php à la ligne 51[/quote]
Merci de bien vouloir m'aider encore une fois