Page 1 of 1

navigation

Posted: Thu Dec 02, 2004 9:35 am
by mohson
patrikG | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Im using the code below suggested by another developer on this forum to limit the number of results per page and then navigate through them. The limit part limits the number of records that appear, the person then suggested that I turn 0 into a variable, they then refer to 0 as $start so I am assuming they mean turn 0 into $start  but when I do this and replace the 0 with $start the limit function doesnt work any more also when I add...

iif(!isset($_REQUEST['start']) ...... code the screen goes blank i think im puttin this in the wrong place or im not setting the variable correctly anyone got any ideas?

/* Performing SQL query */

Code: Select all

<?php

$query = "SELECT * FROM people ORDER BY firstname LIMIT  0, 10"; 
$result = mysql_query($query) or die("Query failed : " . mysql_error());


0= $start

if(!isset($_REQUEST['start']) || $_REQUEST['start']<0){    
 $start = 0;  
}else{    $start = $_REQUEST['start'];  

}

/*And this is to navigate through the records*/


<A HREF="script.php?start=<? echo $start + 10; ?>">Next</A>


?>
I apologise if my question is a bit silly but im a fairly new developer


Can anyone provide any help it would be much appreciated,
Thank you for your time.

patrikG | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Dec 02, 2004 10:27 am
by Dale
>_< Please use tags!

Posted: Mon Dec 06, 2004 6:43 am
by patrikG
mohson - don't start new topics on the same question. Bump the original thread instead.

I've deleted your double-post.

Posted: Mon Dec 06, 2004 6:47 am
by harsha
Using PEAR-PAGING module elimantes the risk.

Posted: Mon Dec 06, 2004 6:50 am
by mohson
but will people actually look back through the previous posts, wont people just assume those posts are old and only look at current ones -??