MySQL给出了这个错误:
SQLSTATE[HY093]: Invalid parameter number
对于这个查询:
public function getUserFriends($userId) {
$query = "SELECT users.id, users.firstName, users.lastName, users.thumbPic FROM friendships LEFT JOIN users ON ((friendships.user1 = users.id OR friendships.user2 = users.id) AND users.id <> :userId) WHERE (user1 = :userId OR user2 = :userId) AND friendships.status = 1";
return $this->adapter->prepare($query)->execute(array(':userId' => $userId))->fetchAll();
}
参数编号对我来说看起来不错还是我错过了什么?