navigation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mohson
Forum Contributor
Posts: 372
Joined: Thu Dec 02, 2004 6:58 am
Location: London

navigation

Post 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]
Last edited by mohson on Thu Dec 02, 2004 10:31 am, edited 1 time in total.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

>_< Please use tags!
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

mohson - don't start new topics on the same question. Bump the original thread instead.

I've deleted your double-post.
User avatar
harsha
Forum Contributor
Posts: 103
Joined: Thu Jul 11, 2002 1:35 am
Location: Bengaluru (Bangalore) > Karnataka > India

Post by harsha »

Using PEAR-PAGING module elimantes the risk.
mohson
Forum Contributor
Posts: 372
Joined: Thu Dec 02, 2004 6:58 am
Location: London

Post 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 -??
Post Reply