$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();
}
以上是我的代码,我知道问题出在哪里,$topics=$dbh->prepare("SELECT * FROM topictable ORDER BY RAND() LIMIT ?")
因为当我更改时?到8,它的工作原理。请赐教。谢谢。