getting previous, current, and next data from database - 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: getting previous, current, and next data from database (/showthread.php?tid=79302) |
getting previous, current, and next data from database - cypherusuh - 05-26-2021 I'm beginner in CI4 and currently learning about database handling. I want to make a phone display site, where user could select a phone, then check previous and next entry / model. So I know about getResult() and how to show everything, and I know that getRow(##) could return specific row. There's also getNextRow() and getPreviousRow(), but I can't find the proper way of using it. I'm not even sure how I could find the "current" index of item I'm browsing. Do I skipped some step on database handling? I can't use cheap trick like "item_ID - 1", because the ID is somewhat mixed up between brand (like Nokia, LG, iPhone, for example). RE: getting previous, current, and next data from database - InsiteFX - 05-26-2021 Not tested but I believe it works like this. PHP Code: $query = $db->query("YOUR QUERY"); Give that a try. |