這就是我如何創建search option does not appear on the page這個線程和罰款我必須工作,但這是我應該如何查找表中的3個領域,它以任何方式工作。同時搜索三個區域,
if($stmt = $this->mysqli->prepare('SELECT `navn`, `link`, `img`, `omrade` FROM `ordblindtest` WHERE `navn` LIKE "%" . $navn . "%" OR `omrade` LIKE "%" . $omrade . "%" OR `sogord` LIKE "%" . $sogord . "%"'))
{
$stmt->bind_param('sss', $navn, $omrade, $sogord);
$navn = $_POST["sogord"];
$omrade = $_POST["sogord"];
$sogord = $_POST["sogord"];
...
}
問題是,我得到這個錯誤:
Error on: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '. $navn . "%", OR
omrade
LIKE "%" . $omrade . "%", ORsogord
LIKE "%" . $sog' at line 1
我不明白爲什麼它似乎有錯誤。爲什麼我收到錯誤?
你注入的變量到你的查詢。這不是如何使用準備好的語句。 – h2ooooooo
[搜索選項沒有出現在頁面上]可能的重複(http://stackoverflow.com/questions/21407213/search-option-does-not-appear-on-the-page) – MichaelRushton