[eluser]mitnick[/eluser]
I created a new helper file called snippet_helper.php
Inside it i have the following.
Code:
<?php
function get_body($id)
{
// here you need to use the CI super object like so:
$CI = &get;_instance();
// now you can access the database via $CI instead of $this, eg.
$CI->db->select('body')->from('snippets')->where('ID', $id);
$query = $CI->db->get();
$result = $query->row();
$body = $result->body;
return $body
}
And added
Code:
$this->load->helper('snippet');
to my admin.php controller.
Can you see anything wrong with this?. I have a table called "snippets" in the DB with the structure of ID,Title,Body.