One of my users reported not being able to view/manage their last pet, and clicking the next page pagination just shows the last pet from the first page. (They have 16, but can only see 15) The pet they can't see is their favorite/active pet if that helps.
PHP Code:
public function index(){
$mysidia = Registry::get("mysidia");
$total = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}'")->rowCount();
$pagination = new Pagination($total, 10, "myadopts");
$pagination->setPage($mysidia->input->get("page"));
//Attempting to sort!
$sort = $mysidia->db->select("users_options", array("petsort"), "username = '{$mysidia->user->username}'")->fetchColumn();
switch ($sort){
case 'clicks':
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' ORDER BY totalclicks LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
break;
case 'gender':
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' ORDER BY gender LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
break;
case 'level':
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' ORDER BY currentlevel LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
break;
case 'name':
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' ORDER BY name LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}");
break;
}
//Sorting ends here!
$this->setField("pagination", $pagination);
$this->setField("stmt", new DatabaseStatement($stmt));
}
(myadopts.php)
Continued in next post...