![]() |
Severity: 4096 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Severity: 4096 (/showthread.php?tid=34657) |
Severity: 4096 - El Forum - 10-06-2010 [eluser]oldrock[/eluser] Hello Guys, Im new with CI and i got little problem here. I've read the posts with the same error msg but i couldn't figure out whats the problem. CODE: Controller: function add_player_details() { $this->load->model('admin_tool/addplayermodel'); $data['teams']=$this->addplayermodel->select_teams(); echo $data['teams']; $this->load->helper(array('url','form')); $this->load->view('admin-tool/add_player',$data); } Model: function select_teams() { $query = $this->db->query("SELECT team FROM team"); if($query) { return $query; } else { return mysql_error(); } } And i get this error: Severity: 4096 Message: Object of class CI_DB_mysql_result could not be converted to string Filename: admin-tool1/login.php Line Number: 68 Thanks in advance Severity: 4096 - El Forum - 10-06-2010 [eluser]eoinmcg[/eluser] echo is for outputting strings, however, your model method 'select_teams()' returns a resource from the database. if you want to check it, for debugging purposes, try using var_dump() instead. to display the results you'll need to do sth like this (in your view): Code: foreach($teams->result_array() as $team) Severity: 4096 - El Forum - 10-06-2010 [eluser]oldrock[/eluser] Hi.., that has done the job thank you very much for your help at right time. |