Object of class CI_DB_mysql_result could not be converted to string - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Object of class CI_DB_mysql_result could not be converted to string (/showthread.php?tid=12279) |
Object of class CI_DB_mysql_result could not be converted to string - El Forum - 10-13-2008 [eluser]Mitja B.[/eluser] Code: $data['title'] = ":: BlueTraker :: Home ::"; and i get Quote:A PHP Error was encountered What is wrong here? Object of class CI_DB_mysql_result could not be converted to string - El Forum - 10-13-2008 [eluser]xwero[/eluser] You can't add the query object as content. You have to use the result method before you pass it on to the table library. Object of class CI_DB_mysql_result could not be converted to string - El Forum - 12-09-2008 [eluser]Lotus18[/eluser] [quote author="xwero" date="1223917015"]You can't add the query object as content. You have to use the result method before you pass it on to the table library.[/quote] What do you mean by result method? I also have same problem with the OP. I read this article but I guess this is wrong or maybe I don't really get it. Please give us some example on how to this or give me some sites regarding this problem. So far I have this code: Code: function comments(){ Any suggestions will be greatly appreciated Rey Sean Object of class CI_DB_mysql_result could not be converted to string - El Forum - 12-09-2008 [eluser]Lotus18[/eluser] As I woke up early this morning and after a series of trial and error at last I got it Object of class CI_DB_mysql_result could not be converted to string - El Forum - 02-22-2009 [eluser]Jan_1[/eluser] Could you please explain how you solved it? Got the same - Need a hint. Thank you!!! Object of class CI_DB_mysql_result could not be converted to string - El Forum - 11-02-2009 [eluser]andrewtheandroid[/eluser] [quote author="Jan from Hamburg" date="1235317167"]Could you please explain how you solved it? Got the same - Need a hint. Thank you!!![/quote] I know this is an old post but for anyone else wondering how to solve this.. What the first reply meant was that you can't convert the query object to a result. To do this you need to use the result() or result_array() method in the Generating Query Results userguide. Example: Where you are getting your result (eg. a model) Code: function getProfile($staffid) { Where you are parsing the results (eg. controller). and sending to view. Code: // Obtaining result Object of class CI_DB_mysql_result could not be converted to string - El Forum - 12-10-2009 [eluser]seismic[/eluser] This is how i make it: Controller Code: <?php Model: Code: <?php View: Code: <HTML><head></head> |