just a quickie - 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: just a quickie (/showthread.php?tid=14372) |
just a quickie - El Forum - 12-30-2008 [eluser]sore eyes[/eluser] hi, the controller function is: Code: function enterNextShop() The model is this: Code: function getNextShop($old_shop_id) I wish to pull the shop_id and can't figure out what the code $shop_id = $this->data->shop_id; should be. I'd be grateful for a cure. just a quickie - El Forum - 12-31-2008 [eluser]thinkigniter[/eluser] Do you mean in... Code: redirect('welcome/enterShop/'.$shop_id); If so, how do you process the $shop_id. Then create a function in your welcome controller called... Code: function entershop($passed_id){ I hope this is what you meant! Cheers just a quickie - El Forum - 12-31-2008 [eluser]sore eyes[/eluser] hi thinkigniter, many thanks for responding. Happy New Year. I'm new to codeigniter and not too much experience with php either, but I do like CI, it seems like a much better way of managing the work and I do enjoy using it. What I want to do is cycle through records in a database, one at a time. To this end I thought of using the shop_id to select records, and then, to move onto the next record by finding the next larger shop_id and using that to display the next record. The form view, which displays one record and a 'next' button is: Code: <h1><?=$title?></h1> The controller (slightly amended) is: Code: function enterShop() and the model is: Code: function getOneShop($shop_id) The problem is that the variable is not passing over. When clicking the 'next' button the old_shop_id does not pass to the controller. Also the shop_id in the 'redirect' is not being calculated. I hope this makes sense to you and am very grateful for your consideration. just a quickie - El Forum - 12-31-2008 [eluser]ray73864[/eluser] you need to either use row() on the data, eg: Code: $shop_id = $this->data->row()->shop_id; just a quickie - El Forum - 01-01-2009 [eluser]sore eyes[/eluser] hi ray, thanks for responding I changed the controller to: Code: function enterNextShop() (using a constant for the old_shop_id, just to rule any prior errors) and I get an error message Message: Undefined property: Welcome::$data line 36 Fatal error: Call to a member function row() on a non-object in C:\Program Files\xampp\htdocs\retailers\system\application\controllers\welcome.php on line 36 any ideas? just a quickie - El Forum - 01-01-2009 [eluser]sore eyes[/eluser] hi ray, it works! Just a slight variation: Code: function enterNextShop() Many thanks for your help. I'd been stuck on this for a while. |