PDOStatement :: execute () error: SQLSTATE [HY093]: Invalid parameter number [closed]

1

I have the following code, I used another similar one to do an update of the database, but this one now does not work; it gives the following error:

  Warning: PDOStatement :: execute (): SQLSTATE [HY093]: Invalid parameter   number: parameter was not defined in   C: \ wamp \ www \ F1 \ php_programmes \ modateurpilote.php on line 17

<?php
$dbh = new PDO('mysql:host=localhost;dbname=tc4','root','');
$dbh->query('SET NAMES utf8');
$prendre = $dbh->prepare('UPDATE pilotes SET Nom=:mNom, Nationalite= :mNationalite,DateDeNaissance= :mDateDeNaissance, Annees= :mAnnees, Equipe= :mEquipe, NombreDeGP= :mNombreDeGP, Podiums= :mPodiums, Victoires= :mVictoires, TitresPilote= :TitresPilote, Description= :mDescription WHERE Id='.$_POST['id']);
$prendre->execute(array('mNom'=> $_POST['Nom'],
    'mNationalite'=> $_POST['Nationalite'],
    'mDateDeNaissance'=> $_POST['DateDeNaissance'],
    'mAnnees'=> $_POST['Annees'],
    'mEquipe'=> $_POST['Equipe'],
    'mNombreDeGP'=> $_POST['NombreDeGP'],
    'mPodiums'=> $_POST['Podiums'],
    'mVictoires'=> $_POST['Victoires'],
    'mTitresPilote'=> $_POST['TitresPilote'],
    'mDescription'=> $_POST['Description']
    )
);

? >

    
asked by anonymous 02.06.2015 / 21:24

1 answer

2

I discovered the error, it was that I forgot to put the change variable m there to differentiate, in:

TitresPilote= :TitresPilote

What should the case be:

TitresPilote= :mTitresPilote

Then the error occurred because it did not have this parameter defined.

    
02.06.2015 / 21:55