Page 1 of 1

Incorporating Pagination

Posted: Sat Feb 09, 2008 12:55 pm
by taz321
Hi

Im starting to do pagination with my work, basically i am developing a helpdesk system where users would submit requests for any technical issues.

I have a list of 60 requests but want to narrow this down so that only one page shows 10 results and the next page shows the next ten.

i.e Prev 1 2 3 4 5 Next

Iv started to have a go, but no success, any help would be appreciated

Code: Select all

<?php
 
    $query1 = mysql_query("SELECT * FROM form LIMIT $startrow, 10")or die (mysql_error());
    
    if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
    $startrow = 0;
 
    } else {
    $startrow = (int)$_GET['startrow'];
    
    }
 
?>

Re: Incorporating Pagination

Posted: Sat Feb 09, 2008 1:41 pm
by Mordred
You're on the right track, just missing some basic concepts about how var substitution works in strings. Move the query line AFTER you init $startrow.

Also, don't use is_numeric, use ctype_digit instead.