Re: << Previous n Articles

From: Date: Wed, 06 Feb 2002 04:02:07 +0000
Subject: Re: << Previous n Articles
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-83670@lists.php.net to get a copy of this message
Jason, I'm not ssure I follow. $offset is the number i read in in my <a href> $limit is the number displayed. $num_rows is the number of rows in my database. What are you doing with $previous? $previous would be my string, not the previous offset? Could you show me again? > > if(!$offset) > > { > > $offset = 0; > > } > > $limit = 5; > > $num_rows = 13;#I get this from a mysql operation > > > > ##################################################### > > $new_offset = $offset + $limit; > > $disp = $limit; > > if ($new_offset + $limit > $num_rows) > > { > > $disp = $num_rows - $new_offset; > > } > > if ($disp > 0) > > { > > $nextinsert = " <font face=\"arial\" size=2><A > HREF=\"index.html?offset=".$new_offset."\">Next ".$disp." > Articles > &gt;&gt;</a></font>\n"; > > } > > > > Something like: > > $previous = $offset - $limit; > if ($previous < 0) { $previous = 0; } > > then incorporate $previous into your previous link in a similar fashion to > the next link.

« previous php.general (#83670) next »