[eluser]Unknown[/eluser]
I am writing a helper function in which I need to query the database. I have tried the following in my helper function.
Code:
$this->db->query("SELECT * FROM fish WHERE species='tuna'");
However, I get this error:
Code:
Fatal error: Using $this when not in object context in /home/john/myProjects/application/helpers/fish_helper.php on line 9
What is the proper way to execute a database query in a helper function? Thank you.
--- Update ---
I broke CodeIgniter abstraction barriers and used the mysql_query() function. Is there a way to do this through the CodeIgniter interface?