![]() |
Help creating "next" button - 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: Help creating "next" button (/showthread.php?tid=15402) |
Help creating "next" button - El Forum - 02-03-2009 [eluser]alberto24[/eluser] Hi CI'ers... I have a small issue I would love some help with. Right now I have a data entry form which when you hit submit takes you to a view page of that same information. What I want to do is make a "next" button so when I edit the data entry form, I click next and go to the next record page. I have no idea how to do this because the db has lots of customers in it and i want to go to the next record for the customer i am on. Any help is greatly appreciated. Help creating "next" button - El Forum - 02-03-2009 [eluser]Nick Husher[/eluser] If your database has ascending customer ID numbers, and you know the customer ID of the record you're looking at, you could run a query that selects the first customer with a higher ID than the one currently being viewed. Help creating "next" button - El Forum - 02-03-2009 [eluser]alberto24[/eluser] Thanks Nick - the problem with what you suggested is that the next id might not be for that customer customer 1 has id 10,15, 17 customer 2 has id 11,12,13,14,16 I want to go from 10 to 15 for customer 1 when the form is submitted Help creating "next" button - El Forum - 02-03-2009 [eluser]Michael Wales[/eluser] Just query the database, ordered by id DESC, where the id is greater than the current record's ID. Code: $this->db->order_by('id', 'DESC'); Help creating "next" button - El Forum - 02-04-2009 [eluser]alberto24[/eluser] thank you - will try that! |