i have a sintax error with PDO
when i try a prepared query with limit like this :
LIMIT :myLimit'); i have an error in mysql :' (
what's wrong whith this?
when i just put the number it's ok, like this : Limit 2
<?php
try{
$repFooterNews = $bdd->prepare('SELECT * FROM newss ORDER BY id DESC LIMIT :myLimit');
$myLimit = 2;
$repFooterNews->execute(array('myLimit'=>$myLimit));
$repFooterNews->setFetchMode(PDO::FETCH_OBJ);
while ($newBas = $repFooterNews->fetch() ){
echo "<div class=\"newsfoot\">";
echo "<h2> $newBas->title</h2>";
echo "<p>$newBas->short</p>";
echo "</div>";
}
}catch (PDOException $e){
echo "Error !: " . $e->getMessage() . "<br/>";
}
?>