If you retrieve a content from database, is simple if the record you have to display is short the problem will appear when the records is too big to fit in one page, then you have split it in to several pages. This snippet gives you a page-scroller with link << PREV and NEXT >>
By :
<? /******************************************************************** * page scroller code snippet. * * Copyright (C) 2001 Wibisono Sastrodiwiryo. * This program is free software licensed under the * GNU General Public License (GPL). * * CyberGL => Application Service Provider * http://www.cybergl.co.id * office@cybergl.co.id * * $Id: scroller.php3,v 0.1 2001/05/20 20:12:21 wibi Exp $ *********************************************************************/
$offset+=0; $item_perpage= 2; #----change this to define how many item per page $prev= $offset-$item_perpage; $next= $offset+$item_perpage; if ($prev <= 0) $prev=0;
$query="SELECT $field FROM $tbl_search WHERE $field LIKE '%$keyword%' LIMIT $offset, $item_perpage"; #----modify the where clause to fit your query need
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.