Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function result() on a non-object in
#1

[eluser]Unknown[/eluser]
i ok now i know that the db conf file is ok, and now i can't do a simple query

i have my table articulos and this code

class Blog extends Controller{

function Blog(){
parent::Controller();
$this->load->helper('text');
$this->load->database();
}

function index()
{
$data['title'] = 'Maternonet - Blog';
$data['articulos'] = $this->db->get('articulos');
$this->load->view('head_view',$data);
$this->load->view('menu_view');
$this->load->view('blog_view',$data);
$this->load->view('footer_view');
}

}
--------------------------------------

and view

<?php foreach($articulos->result() as $articulo):?> (line 1)
<BR>
<h2>&lt;?=$articulo->titulo?&gt;</h2>
<h5>Por: &lt;?=$articulo->autor?&gt;</h5>
<h6>&lt;?=$articulo->fecha?&gt;</h6>
<p>&lt;?=word_limiter($articulo->cuerpo,100)?&gt;</p>
<br />
&lt;?=anchor('blog/ver/'.$articulo->id,'Leer mas...')?&gt;
<br />
<br />
<hr/>
&lt;?php endforeach;?&gt;


and i recibe this error
Fatal error: Call to a member function result() on a non-object in line 1
y dump the var $articulos and i see this bool(false)
#2

[eluser]Thorpe Obazee[/eluser]
do you have data in the table?

Try echoing

Code:
$this->db->last_query();

to see what kind of query is being used. You can also try using it in your Mysql gui(usually phpmyadmin) and see if it generates any problem.




Theme © iAndrew 2016 - Forum software by © MyBB