Page 1 of 1

table limit

Posted: Fri Jun 29, 2012 9:30 am
by jayson.ph
hi all,

i have table and it have a thousand of rows or data and to make it net and clear to a user, i put a limit in 100 as row. but how can i do to view other data?

Re: table limit

Posted: Fri Jun 29, 2012 11:11 am
by Celauran
Pagination. Use an offset with your limit.

Code: Select all

$limit = 100;
$offset = ($_GET['page'] - 1) * $limit;
$query = "Blah blah whatever LIMIT $offset, $limit";

Re: table limit

Posted: Tue Jul 10, 2012 8:18 pm
by jayson.ph
Thank for this and where should i put this code as you show up above.

Re: table limit

Posted: Wed Jul 11, 2012 9:48 am
by pickle
It's probably best if you do some research on the concept of pagination, as it's generally a larger concept than is suitable for a forum post.

Re: table limit

Posted: Wed Jul 11, 2012 4:21 pm
by mekha
Thank for this and where should i put this code as you show up above.

If it is a paging,you can put it in the top of the page , for example:

Code: Select all

<?php
//any code
?>

<html>
<head></head>
<body></body>
</html>

But!!
if your code is include loops or something like loop(foreach,for,while..exc..) you must put it in the right place , In the top of the page(like the previous example) or any place that match your full code!...
i wish i helped you,if not,,someone else may help you :D