Converting a Mysql Result Object to Associative Array (CodeIgniter)

bandare

New Member
I'm trying to get a database query which is an object converted to an associative array, so that I can use it in the calendar class in codeigniter.This is my model:\[code\]<?phpclass Get_diary_model extends Model { function getAllDiaries($year,$month) { $data = http://stackoverflow.com/questions/3725980/$this->db->query("SELECT day AND entry FROM diary WHERE month=$month AND year=$year"); // the entries for the relevant month and year foreach($data->result_array() as $row) { // return result as assoc array to use in calendar echo $row['day']; echo $row['entry']; } return $data; } }\[/code\]and this is the error I get:\[code\]atal error: Cannot use object of type CI_DB_mysql_result as array in C:\wamp\www\mm\system\libraries\Calendar.php on line 219\[/code\]Any ideas?
 
Back
Top