var_dump($query) = string(133) "SELECT t1.*, t2.* FROM movies t1, releases t2 WHERE t1.id = t2.movieid AND title LIKE ? AND LOCATE (?, subtitles) ORDER BY added DESC"
var_dump($qqq) = array(2) { [0]=> string(9) "'%brian%'" [1]=> string(9) "'English'" }
$stmt = $pdo->prepare($query);
if ($stmt->execute($qqq)){
echo $stmt->rowCount();
}else{
echo "Not";
}
返回0,查询有效,但没有结果。
如果我跑" SELECT t1.*, t2.* FROM movies t1, releases t2 WHERE t1.id = t2.movieid AND title LIKE '%brian%' AND LOCATE ('English', subtitles) ORDER BY added DESC
"在phpmyadmin我得到了结果。我不知道在哪里看,检查我所知道的一切。
答案 0 :(得分:2)
您不应该在参数中包含引号。 $qqq
应如下所示:
$qqq = array("%brian%", "English");