Welcome Guest, Not a member yet? Register   Sign In
Call to a member function num_rows() on a non-object
#11

[eluser]Zorancho[/eluser]
Try using this:
Code:
function compare($fid, $uid)
{
    $fid = (int) $fid;
    $uid = (int) $uid;
    $sql = "SELECT * FROM friends_list WHERE approved_status = 'yes' AND user_id=".$uid." AND friend_id=".$fid." OR
    (friend_id=".$uid." AND user_id=".$fid.") LIMIT 1";
    $q = $this->db->query($sql);
    if($q->num_rows() > 0)
    {
        return true;
    }
    return false;
}
It worked for me
#12

[eluser]Zorancho[/eluser]
After this line
Code:
$userId = (trim($userId) == '') ? $this->session->userdata('user_id') : $userId;

Check if the $userId is empty string
Code:
if($userId == '')
return false;
That's your problem in your query.




Theme © iAndrew 2016 - Forum software by © MyBB