after editing my old code to new i get error Undefined property: PDO::$affected_rows
and here is the part if ($this->dbCon->affected_rows > 0)
can some one help me to solve this problem
class Relation {
private $loggedInUser;
private $dbCon;
public function getRelationship(User $user) {
$user_one = (int) $this->loggedInUser->getUserId();
$user_two = (int) $user->getUserId();
if ($user_one > $user_two) {
$temp = $user_one;
$user_one = $user_two;
$user_two = $temp;
}
$resultObj = $this->dbCon->prepare('SELECT * FROM relationship WHERE user_one_id=:user_one AND user_two_id=:user_two');
$resultObj->execute(array(':user_one' => $user_one,':user_two' => $user_two));
if ($this->dbCon->affected_rows > 0) {
$row = $resultObj->fetch(PDO::FETCH_ASSOC);
$relationship = new Relationship();
$relationship->arrToRelationship($row, $this->dbCon);
return $relationship;
}
return false;
}
}}