Getting following errors while running logs,
Notice: Undefined variable: prepare in /srv/users/inv/apps/inv/public/inc/logs_core.php on line 75 Fatal error: Call to a member function bind_param() on null in /srv/users/inv/apps/inv/public/inc/logs_core.php on line 75
public function count_logs($itemid, $catid, $userid) {
if($itemid != false){
$prepared = $this->prepare("SELECT COUNT(*) as c FROM invento_logs WHERE item=?", 'count_logs()');
$this->bind_param($prepare->bind_param('i', $itemid), 'count_logs()');
}elseif($catid != false){
$prepared = $this->prepare("SELECT COUNT(*) as c FROM invento_logs WHERE item IN (SELECT id FROM invento_items WHERE category=?)", 'count_logs()');
$this->bind_param($prepare->bind_param('i', $catid), 'count_logs()');
}elseif($userid != false){
$prepared = $this->prepare("SELECT COUNT(*) as c FROM invento_logs WHERE `user`=?", 'count_logs()');
$this->bind_param($prepare->bind_param('i', $userid), 'count_logs()');
}else{
$res = $this->query("SELECT COUNT(*) as c FROM invento_logs", 'count_logs()');
$obj = $res->fetch_object();
return $obj->c;
}
please guide me to solve the issue