Now I am learning Codeigniter. I have more databases, so I choosed this time Anketa one.
Why is error :
**Fatal error: Call to a member function query() on a non-object in /var/www/domains/svastara/application/controllers/anketa.php on line 12** ???
I chacked, the user and pass in database is ok, database is loaded in conf, and chacked the table name. So what more?
$this->db = $this->load->database('anketa');
$q = $this->db->query("SELECT * FROM anketaip");
if($q->num_rows()>0){
foreach ($q->result() as $row)
{
$data[] = $row;
}
}return $data;
$this->load->view('anketa_nova', $data);
Below line doesn’t return you database object until you pass second argument as TRUE
Change:
To
Reference Link: http://codeigniter.com/user_guide/database/connecting.html