[eluser]sophistry[/eluser]
this works for me...
not sure what the issue was for your set up. maybe calling the db in two separate controller calls? a redirect in between? some setting that resets the db connection after every single query?
The model:
Code:
<?php
class Tester_model extends Model {
function Tester_model()
{
// Call the Model constructor
parent::Model();
}
function get_one()
{
$this->db->select('SQL_CALC_FOUND_ROWS *');
$this->db->limit(1);
$q = $this->db->get('address');
$r = $q->row();
return $r;
}
function get_found_rows()
{
$this->db->select('FOUND_ROWS() as total');
$this->db->limit(1);
$q = $this->db->get('address');
$r = $q->row();
return $r->total;
}
}
?>
The controller:
Code:
<?php
class Tester extends Controller {
function Tester()
{
parent::Controller();
}
function test_found_rows()
{
$this->load->model('tester_model');
$record = $this->tester_model->get_one();
print_r($record);
$record = $this->tester_model->get_found_rows();
print_r($record);
}
}
?>
Let us know if this works for you... you will be happier down the road if you design like this instead of using a single return array.