Normal PHP to Codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Normal PHP to Codeigniter (/showthread.php?tid=75970) |
Normal PHP to Codeigniter - Matt - 04-02-2020 I'm stuck trying to figure this out . I would like to convert this HTML PHP page to one made with CI.[This is what I want to get (done with basic php )][1] and this is what I can mange to do with Codeigniter [This is the result with Codeigniter][2] Here is my views page Code: <head> And here is my controller file Code: <?php What should ,someone told me to use a foreach statement but I'm not sure where. Could someone please take a few momments to explain to me step by step how to solve this? Im new to CI [1]: https://i.stack.imgur.com/30SQ4.png [2]: https://i.stack.imgur.com/IW50i.png RE: Normal PHP to Codeigniter - Matt - 04-08-2020 Any help ? RE: Normal PHP to Codeigniter - jreklund - 04-08-2020 You need to fetch your results as an array with result_array() instead of result() as the paser want's an array and not an object. https://codeigniter.com/userguide3/libraries/parser.html https://codeigniter.com/userguide3/database/results.html PHP Code: $alimente = $this->db->query('select name as aliment from alimente')->result_array(); |