![]() |
Simple foreach loop not working (code) - 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: Simple foreach loop not working (code) (/showthread.php?tid=49378) |
Simple foreach loop not working (code) - El Forum - 02-17-2012 [eluser]David Mitchell[/eluser] Controller Code: //Home index.php view file Code: <? include("include/header.php"); ?> Its not displaying anything, and the database is working fine. Have I done something Wrong? David Simple foreach loop not working (code) - El Forum - 02-17-2012 [eluser]aquary[/eluser] Not sure since it's not the way I code. Try this: Code: //Home Code: <? include("include/header.php"); ?> Simple foreach loop not working (code) - El Forum - 02-17-2012 [eluser]David Mitchell[/eluser] Thanks aquary but now it says an error for each of the echo statements: Code: A PHP Error was encountered Code: object(CI_DB_mysql_result)#15 (8) { ["conn_id"]=> resource(30) of type (mysql link persistent) ["result_id"]=> resource(38) of type (mysql result) ["result_array"]=> array(0) { } ["result_object"]=> array(0) { } ["custom_result_object"]=> array(0) { } ["current_row"]=> int(0) ["num_rows"]=> int(3) ["row_data"]=> NULL } I dont understand. You say that this isnt how you would code it, is there a more efficant way? David Simple foreach loop not working (code) - El Forum - 02-17-2012 [eluser]David Mitchell[/eluser] Found the Problem: Code: echo $row->user; should of been Code: echo $row['user']; |