![]() |
Ouputting content from database returns the word Array - 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: Ouputting content from database returns the word Array (/showthread.php?tid=25400) |
Ouputting content from database returns the word Array - El Forum - 12-10-2009 [eluser]Unknown[/eluser] Hello codeigniter community, I am going through some of the examples in the documentation and when I output my database content it only outputs the word Array. I am using codeigniter with XAMPP. Also I am new to all these technologies so it is possible that I could have made a mistake creating my database or made a mistake anywhere else. Here is the code: Code: <?php Code: ?php Code: <html> Here are my database settings: Code: INSERT INTO `montage`.`links` (`name`, `url`, `section`) VALUES ('Jimmy', 'blablabla', 'home'); Thank you for your time :-) Ouputting content from database returns the word Array - El Forum - 12-10-2009 [eluser]BrianDHall[/eluser] Sure, is extremely easy to fix for you. In your get_entries() you are calling result_array(), which returns...an Array ![]() So if you just try to echo $query PHP will throw an error (your error level probably isn't set to show such lower level notices/errors as they are not critical) and output Array. Try this in your view: <?php var_dump($query);?> This will let you know the structure of the array you are dealing with, thus you can determine if you need to use a foreach, acccess an element directly (like, say, $query['name']), or if you would prefer to use a result method other than result_array() Ouputting content from database returns the word Array - El Forum - 12-10-2009 [eluser]Unknown[/eluser] Thanks BrianDHall that helped a lot. :coolsmile: |