I currently have
我现在有
$query = "SELECT *
FROM table
WHERE position = ?
AND (CONTAINS(first_name, ?)
OR CONTAINS(last_name, ?))";
$stmt = $db->prepare($query);
$stmt->bindValue(1, $position, PDO::PARAM_STR);
$stmt->bindValue(2, "%{".$q."}%", PDO::PARAM_STR);
$stmt->bindValue(3, "%{".$q."}%", PDO::PARAM_STR);
$stmt->execute()or die("error");
The script keeps on dying.
剧本继续濒临死亡。
Any ideas?
2 个解决方案
#1
0
Use LIKE:
SELECT *
FROM table
WHERE position = ?
AND first_name LIKE ?
OR last_name LIKE ?
#2
0
CONTAINS
is SQL server syntax, not MySQL. use LIKE
CONTAINS是SQL服务器语法,而不是MySQL。使用LIKE
#1
0
Use LIKE:
SELECT *
FROM table
WHERE position = ?
AND first_name LIKE ?
OR last_name LIKE ?
#2
0
CONTAINS
is SQL server syntax, not MySQL. use LIKE
CONTAINS是SQL服务器语法,而不是MySQL。使用LIKE