Welcome Guest, Not a member yet? Register   Sign In
Message: Object of class CI_DB_mysql_result could not be converted to string
#1

[eluser]ademar[/eluser]
Hello Guys,

Im new with CI and i got little problem here. I've read the posts with the same error msg but i couldn't figure out whats the problem.


CODE:

Controller:

function index(){

$this->load->model('test_model');

$data['test'] = $this->test_model->get_all();

$this->table->set_heading('Id', 'Desc');

echo $this->table->generate($data);
}

Model:

function get_all(){

$query = $this->db->query("select * from test");

return $query;
}

And i get this error:
Severity: 4096

Message: Object of class CI_DB_mysql_result could not be converted to string

Filename: libraries/Table.php

Line Number: 269


So i've read some questions if you should or not use return $query or returno $query->result() but if i try with ->result() i get this other error:

A PHP Error was encountered

Severity: 4096

Message: Object of class stdClass could not be converted to string

Filename: libraries/Table.php

Line Number: 269


So, does anyone see what i've forgotten ? I've tried to read other posts but got unlucky.

Thanks,

D


Messages In This Thread
Message: Object of class CI_DB_mysql_result could not be converted to string - by El Forum - 08-25-2010, 07:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB