Possible Duplicate:
PHP PDO bindValue in LIMIT
$number=8;
try {
$topics=$dbh->prepare("SELECT * FROM topictable ORDER BY RAND() LIMIT ?");
$topics->execute(array($number));
$topicarray = $topics->fetch(PDO::FETCH_BOTH);
print_r($topicarray);
}
catch(PDOException $e) {
echo $e->getMessage();
}
Above is my code, I know the problem comes from $topics=$dbh->prepare("SELECT * FROM topictable ORDER BY RAND() LIMIT ?")
because when i change ? to 8, it works. Please enlighten me. Thanks.