I have a problem to make an UPDATE request using PDO.
I have a problem in my syntax somewhere but i don't know where..
Here is my code :
<?php
$PARAM_hote='aaaaaaaa';
$PARAM_port='3306';
$PARAM_nom_bd='bbbbbbbbbbb';
$PARAM_utilisateur='cccccccccccccc';
$PARAM_mot_passe='ddddddddddd';
// Create connexion to BDD
$connexion = new PDO('mysql:host='.$PARAM_hote.';port='.$PARAM_port.';dbname='.$PARAM_nom_bd, $PARAM_utilisateur, $PARAM_mot_passe);
try {
$idAnnonce = $_POST['idAnnonce'];
$sqlUpdate = "UPDATE `annonces` SET `etat` = `offline` WHERE `id` = :idAnnonce ";
$resultats = $connexion->prepare($sqlUpdate);
$resultats->bindValue(':idAnnonce', $idAnnonce, PDO::PARAM_INT);
$resultats->execute();
// Check if request is success
echo $resultats->rowCount();
} catch(Exception $e) {
echo 'Erreur : '.$e->getMessage().'<br />';
echo 'N° : '.$e->getCode();
}
?>