• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.