-1

Warning: count(): Parameter must be an array or an object that implements Countable on line 5

<?php
class ModelSliderTGsuperstarRevolutionSlider extends Model {        
public function getSlider($id) {
    $query = $this->db->query("SELECT * FROM ".DB_PREFIX."tg_superstar_revolution_slider WHERE id='".$id."'");
    if( count($query) ) {
        foreach($query->rows as $row) {
            $output = array(
                'id' => $row['id'],
                'settings' => unserialize($row['settings']),
                'content' => unserialize($row['content'])
            );
            return $output;
        }
    }
    return false;
}

}
?>

https://hcforklift.ch/

How can I fix this error? Many thanks! JJ

Alon Eitan
  • 11,997
  • 8
  • 49
  • 58
jja1377jja
  • 21
  • 1

1 Answers1

0

Are you using Codeigniter?

$this->db->query("SELECT * FROM ".DB_PREFIX."tg_superstar_revolution_slider WHERE id='".$id."'")

In this line you aren't fetching any row, you are just querying aganist the database

Add the get and result method if you are using Codeigniter.

$this->db->query("SELECT * FROM ".DB_PREFIX."tg_superstar_revolution_slider WHERE id=?", [$id])->get()->result(); 
Gazmend Sahiti
  • 443
  • 3
  • 13