$query=SELECT * FROM DB WHERE MATCH (email, name, live)
AGAINST (:search IN BOOLEAN MODE) LIMIT :start, 20";
//:start is row count from previous query
$SQL=$db->prepare($query);
$SQL->bindValue(':search', '+'.$search.'*', PDO::PARAM_STR);
嗨,我是PHP PDO的新手,我有一个全文搜索查询使用PDO
这样绑定值是否正确,我将{strong> + 和 * 置于bindValue();
答案 0 :(得分:3)
SELECT * FROM DB WHERE MATCH (email, name, live)
AGAINST ('+searchword1 +searchword2*' IN BOOLEAN MODE)
会变成类似的东西:
SELECT * FROM DB WHERE MATCH (email, name, live)
AGAINST (:search IN BOOLEAN MODE)
$value = '+searchword1 +searchword2*';
$SQL = $db->prepare($query);
$SQL->bindValue(':search', $value, PDO::PARAM_STR);