Eroare: Call to a member function num_rows() on boolean
Scris: Dum Noi 26, 2017
Am intr-un fisier cateva linii de cod care primesc eroare:
In codul php:
Primesc eroare la linia 115, adica:
Tabela este incarcata, contine acele coloane ... nu am idee de ce afiseaza eroarea.
Cod: Selectaţi tot
Fatal error: Call to a member function num_rows() on boolean in cale_fisier on line 115
Cod: Selectaţi tot
public function get_profile_info($uid_username)
{
if(empty($uid_username))
return false;
$sql = 'SELECT u.user_id,u.username,u.email,u.email_visibility,u.sex,u.main_image,u.birth_date,u.city_id,u.country_id,u.interest_id,u.zodiac,u.web_confirmed,u.description,u.vote_points,u.visits,
u.stickers,u.gifts,u.activity_points,u.bonus_points,u.gift_points,u.total_points,u.coins,u.comments,u.log_records,u.virtual_seif,u.blog_posts,
u.webpage,u.facebook,u.hi5,u.relationship,u.education,u.registration_date,u.last_login,u.meta_data,
c.name AS country,ci.name AS city,intr.content AS interest
FROM '.TBL_USERS.' u ';
if(!is_numeric($uid_username))
{
$sql.= ' USE INDEX(username) ';
}
$sql.= ' INNER JOIN '.TBL_COUNTRIES.' c ON c.country_id=u.country_id
INNER JOIN '.TBL_CITIES.' ci ON ci.city_id=u.city_id
INNER JOIN '.TBL_USER_INTERESTS.' intr ON intr.interest_id=u.interest_id ';
if(is_numeric($uid_username) && $uid_username > 0)
{
$sql.=' WHERE u.user_id = ? AND u.status="active" LIMIT 1 ';
}
else
{
$sql.=' WHERE u.username = ? AND u.status="active" LIMIT 1 ';
}
$query = $this->db->query($sql,array($uid_username));
return ($query->num_rows() > 0) ? $query->row() : FALSE ;
}
Cod: Selectaţi tot
return ($query->num_rows() > 0) ? $query->row() : FALSE ;