我有一個無效的參數錯誤,但我想我有正確的編號參數。無效的參數編號錯誤
有沒有人在這裏看到相反的?
林收到這個錯誤:
PDOStatement對象::執行():SQLSTATE [HY093]:無效參數號:綁定變量的數目不$ readNews-匹配的令牌數>執行();
if(isset($_POST['search']))
{
$search = $_POST['search'];
$readNews = $pdo->prepare("SELECT * FROM news WHERE title LIKE ? ORDER BY date DESC LIMIT ?, ?");
$readNews->bindValue(1, $search);
$readNews->bindValue(1, $begin,PDO::PARAM_INT);
$readNews->bindValue(2, $max,PDO::PARAM_INT);
}
else
{
$readNews = $pdo->prepare("SELECT * FROM news ORDER BY date DESC LIMIT ?, ?");
$readNews->bindValue(1, $begin,PDO::PARAM_INT);
$readNews->bindValue(2, $max,PDO::PARAM_INT);
}
$readNews->execute();
不要使用'和'用逗號'SELECT * FROM新聞,標題LIKE' –
但標題不是表,標題是一個專欄中,我想選擇*來自新聞的標題,如$搜索! – John23
您可能打算使用'WHERE'作爲Phil在下面發佈。我早些時候看到了[你的其他問題](http://stackoverflow.com/q/22851219/),這讓我很難理解它。我知道我是對的。 –