Hi Petre Why not use LIMIT in your query? Like this:
<?php //open database connection //make query If(!isSet($_GET['entry']) { $_GET['entry']="0"; } $sql_query="SELECT id,row1,row2,row3 FROM table WHERE something='$whatever' ORDER BY id ASC LIMIT $_GET['entry'], 10"; $sql_id = mysql_query($sql_query,$link) or die("error in query"); $prev = $_GET['entry']-10; $next = $_GET['entry']+10; for ($i=0;$i<mysql_num_rows($sql_id);$i++) { //Get all entries from database $sql = mysql_fetch_assoc($sql_id); //do whatever here echo "<td>".$sql['id']."</td>"; } //navigation Echo" ".($prev>=0?"<a href=\"$PHP_SELF?entry=$prev\" class=\"nav\">Previous page</a>":"")." ".($total_count>=$next+1?"<a href=\"$PHP_SELF?entry=$next\" class=\"nav\">Next page</a>":"").""; ?> I hope this helps you. Best regards, Davy Obdam The Netherlands mailto:info@;davyobdam.com > -----Oorspronkelijk bericht----- > Van: Petre Agenbag [mailto:internet@;vsa.co.za] > Verzonden: dinsdag 29 oktober 2002 13:07 > Aan: [EMAIL PROTECTED] > Onderwerp: [PHP] back and forward through a result query > > > Hi > I need to do the following, and have a slight idea of how to > do it, but I'm not sure... > > I want to do a "select id from table where something = > "whatever" ", then I will display all the "hits" from that > query as links to a "display" page, sending along the id's of the row. > > On that next page, I will use that id to retrieve the > relevant data to display for that specific record, but, I > want to have a previous|next function, that will display the > relevant data of the previous or next record as was displayed > on the original page that showed the list of "hits". So I > *think* I should create an array containing all the id's of > that query, and send it along with the clickthrough to the > "display" page and then from there use the array functions > "next" and "prev" to get the id's directly adjacent to the > one I currently have, but I'm not sure if this is the best > way to do it, for one, I don't know how to put those id's > into an array from the original query, and two, don't know > how to tell it to "get prev of current id from array" or "get > next of current id from array". And I think it might be a bit > of an unnecessary overhead to send that entire array via GET > to the display page if you are only ever going to use 2 > values from it, so It would make much more sense to me to > pass the current id, the next id and the previous id for each > "hit" along to the "display" page. > > Any ideas on how I could do that? > > Thanks > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > ================================================================ > Deze e-mail is door E-mail VirusScanner van Planet Internet > gecontroleerd op virussen. Op http://www.planet.nl/evs staat > een verwijzing naar de actuele lijst waar op wordt gecontroleerd. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php