convert code to CI - 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: convert code to CI (/showthread.php?tid=9546) |
convert code to CI - El Forum - 06-29-2008 [eluser]Mitja B.[/eluser] Code: while($row = mysql_fetch_assoc($result)) i want to add this code inside controller that i will use it in view. I try like this. Code: foreach ($query->result() as $row) but i get error of Fatal error: Cannot use object of type stdClass as array in C:\HTTPSERVER\wwwroot\bewoop\system\application\controllers\admin.php on line 128 how to make this? Thx convert code to CI - El Forum - 06-29-2008 [eluser]Seppo[/eluser] If you want $row to be an array, you should use result_array method. Otherwise, access it as an object ($row->pool_id) convert code to CI - El Forum - 06-29-2008 [eluser]Mitja B.[/eluser] thx result_array works like a charm. regards |