[eluser]BenKxK[/eluser]
Hi guys. I did a search on the forum but found nothing that helped me so I thought I'd post
. Pretty new to code igniter (about a week now).
I am trying to return a row from the database and then show the contents in a view.
Here is the code I have...
Controller
Code:
function edit() {
$edit = array();
$query = $this->admin_model->edit_row();
$edit['edit'] = $query;
$edit['main_content'] = 'admin/edit_event_view';
$this->load->view('includes/template', $edit);
}
Model
Code:
function edit_row() {
$this->db->where('id', $this->uri->segment(4));
$query = $this->db->get('data');
return $query->result();
}
View
Code:
echo form_input('event_name', $edit->edit_name);
If i do a var dump on $edit i get:
Code:
array(1) { [0]=> object(stdClass)#17 (8) { ["id"]=> string(1) "4" ["event_name"]=> string(3) "Ben" ["info"]=> string(5) "Hello" ["location"]=> string(8) "My house" ["date"]=> string(10) "2011-03-11" ["time_from"]=> string(3) "9am" ["time_to"]=> string(4) "11am" ["organiser"]=> string(10) "Ben Stokoe" } }
(this is random input btw). Can't understand why it isn't working. Any ideas? Thanks