my $page_size = 24; my $page_num = 3; my $offset = ($page_num - 1) * $page_size; my $query = "SELECT items.* from orders JOIN items ON items.order_ +id = orders.id WHERE orders.status='ready' ORDER BY orders.date OFFSE +T $offset LIMIT $page_size"; my $sth = MyClass::db_Main->prepare( $query ); $sth->execute; my @items; # # Construct this page of item objects # while (my $item_data = $sth->fetchrow_hashref()) { push(@items, MyClass::Item->construct($item_data)); }
In reply to Re: Class::DBI Pagination with Table Joins
by snoopy
in thread Class::DBI Pagination with Table Joins
by jgallagher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |