[eluser]mflammia[/eluser]
Been scracthing my head over this one for a while but I just can't seem to explain the results.
I have the following entry in my controller
Code:
function get_records_edit(){
$this->load->model('site_model');
$this->site_model->get_single_record();
$data = $this->results();
echo "<pre>";
echo print_r($data);
echo "<pre>";
And the following entry in my model
Code:
function get_single_record(){
$query = $this->db->query('SELECT * FROM person WHERE id_person='.$this->uri->segment(3));
echo "<pre>";
echo print_r($query);
echo "<pre>";
I should get returned a sinlge entry the model echo returns:
Code:
CI_DB_mysql_result Object
(
[conn_id] => Resource id #29
[result_id] => Resource id #32
[result_array] => Array
(
)
[result_object] => Array
(
)
[custom_result_object] => Array
(
)
[current_row] => 0
[num_rows] => 1
[row_data] =>
)
1
But the controller echo returns an array of all the entries in the id_person table instead of a single entry?
Ive taken the entry
Code:
SELECT * FROM person WHERE id_person='.$this->uri->segment(3)
Saved it to a varible and echo'd it out and it does work properly in translating to something like
Code:
SELECT * FROM person WHERE id_person=7
Help much appreciated in advance.