Welcome Guest, Not a member yet? Register   Sign In
How can i get ( previous, current and next) data from mysql records?
#7

[eluser]K-coder[/eluser]
@dudeami0

Thank you so much that is what i want Big Grin

but your code need a little change to working fine

Code:
$rowid = 1; // 0 = First entry
$sql = "SELECT * FROM `table` LIMIT " . ($rowid-2) . ",3";
$this->db->query($sql);

and that what i did to make it more fixable Smile

Code:
$from = ($id - 2 < 0 ? 0 : $id - 2);
$limit = ($id - 2 < 0 ? 2 : 3);
$this->db->limit($limit, $from);
$query = $this->db->get('item_media');


Messages In This Thread
How can i get ( previous, current and next) data from mysql records? - by El Forum - 11-04-2010, 03:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB