Re: pagination example? Thanks Everybody!
| From: | xkorakidis | Date: | Wed, 23 Nov 2005 21:34:30 +0000 |
| Subject: | Re: pagination example? Thanks Everybody! | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40723@lists.php.net to get a copy of this message | ||
Thanks guys, I'll try all the documentation I and samples collected.
Thanks!
--------------------
Unnawut Leepaisalsuwanna wrote:
> the part
>
> $page = (!is_numeric($_GET['page'])) ? '1' :
> round($_GET['page']);
>
> i believe can help prevent sql injection... i rounded the $_GET['page'] as well in
> case someone tries to put in decimals and ruin the query
>
> the $perpage is the number of rows you want to display
>
>
> xkorakidis wrote:
>
>>hmmm,
>>it seems simple, althought I didn't yet understand what exactly takes
>>part in
>>$page = (!is_numeric($_GET['page'])) ? '1' :
>>round($_GET['page']);
>>it seems like a c expression : if page is not numeric page=1 else round
>>page?
>>How does the $perpage increase?
>>couldn't we use smth $page++ ?
>>Thanks.
>>
>>Unnawut Leepaisalsuwanna wrote:
>>
>>
>>>$perpage = 10;
>>>$page = (!is_numeric($_GET['page'])) ? '1' :
>>>round($_GET['page']);
>>>
>>>$page = ($page-1) * $perpage;
>>>$sql = 'SELECT * FROM
table WHERE 1 LIMIT '.
>>>$page .', '. $perpage;
>>>
>>>something like this?
>>>
>>>xkorakidis wrote:
>>>
>>>
>>>
>>>>Hi, I'm trying to find a simple example for pagination in php-mysql. I
>>>>found smth in php classes but it seems too complex (3-4 files and things
>>>>not so simple). Is there any simple way to do that?
>>>>Thanks.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>