[eluser]J. Pavel Espinal[/eluser]
Hello,
In the CodeIgniter User Guide, "Database Library" documentation, section "Generating Query Results", result() method documentation, it says:
Quote:You can also pass a string to result() which represents a class to instantiate for each result object (note: this class must be loaded)
Code:
$query = $this->db->query("SELECT * FROM users;");
foreach ($query->result('User') as $row)
{
echo $row->name; // call attributes
echo $row->reverse_name(); // or methods defined on the 'User' class
}
The questions are:
a. How should that class be "loaded"?
as a core library?
Code:
$this->load->library('class_name', $config, 'object name')
as a model?
Code:
$this->load->model('Model_name');
or as a generic file (and not sending output to the browser)?
Code:
$this->load->file('filepath/filename', true/false)
Please pardon my ignorance regarding this subject,
Thanks in advance.