Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将查询转换为参数化查询。
我目前的 PHP/SQL 查询是
SELECT * FROM System WHERE information LIKE '%$sheet%' ORDER BY newest DESC;
我将如何参数化这个?
如果$sheet总是一个字符串
$sheet
$query = $database->prepare('SELECT * FROM System WHERE information LIKE ? ORDER BY newest DESC'); $query->bindValue(1, "%$sheet%", PDO::PARAM_STR); $query->execute();
那么这应该工作