Dynamic drop down list help - 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: Dynamic drop down list help (/showthread.php?tid=33550) |
Dynamic drop down list help - El Forum - 08-30-2010 [eluser]Unknown[/eluser] Hey folks, I'm very new to code igniter, and I'm just working my way through a simple dynamic drop down list, but I can't figure out exactly how to get er to work. I've been all over the forums and I can't seem to find anything that will make this happen. So I have my controller all set up, connecting to my database and loading my model, but I'm a litle confused on exactly how to pass the data between model and controller and view, also how to generate the list, do I put the for loop in the view, or in the model then pass the data to the controller, etc. Here's what I have so far, be brutally honest if possible, I apologize if it doesn't make much sense, I've been getting desperate and trying anything really so it's a bit of a mess. Controller Code: <?php Model Code: <?php View Code: <?php echo doctype('xhtml1-trans') ?> Dynamic drop down list help - El Forum - 09-02-2010 [eluser]Nick_MyShuitings[/eluser] Quote:$data = $this->User_model->get_continents(); I think that you need to call either ->result() if you like objects or ->result_array() if you prefer arrays. Then run a echo Code: echo "<pre>"; die(var_dump($data)); if you run a var_dump of $data now you prolly get something along the lines of mysql result object gibberish so.... try this: Code: $data = $this->User_model->get_continents()->result(); |