Here's a Quick & Dirty script that I ran up to get a display of 10 items per
page with each click on a hyper-linked page returning a new page .. if you
know what I mean. I've even included the headers so that any newbies can see
the complete script and not just bits. The theory is that the first sql
statement goes and gets the total number of rows for the display. This is
then held in a global variable. The second query goes and gets the rows
limited by an incrementing number. Simple, huh!
<?
include("radius.inc");
radius_db_connect();
define ("INITIAL_PAGE",0);
$sql="select distinct username from user";
$res=mysql_query($sql) or die ("OK");;
$num_rows=mysql_num_rows($res);
$j=1;
$i=0;
function initial_page(){
global $PHP_SELF, $num_rows, $i,$j, $n;
$sql="select distinct username from user limit $n, 10";
$res=mysql_query($sql);
while($row=mysql_fetch_array($res)){
print $row["username"]."<br>";
}
$k=0;
while($i <= $num_rows){
print "<a href = '$PHP_SELF?action=0&n=$i'> [$k] </a>\n";
$k++;
$i+=10;
}
}
switch($action){
case INITIAL_PAGE:
initial_page();
break;
default:
die ("Could not find function number $action");
}
?>
On Mon, 23 Jul 2001 21:25, you wrote:
> Perhaps I shouldn't have made the assumption that steph was using mysql :)
>
> "Henrik Hansen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > [EMAIL PROTECTED] (James Holloway) wrote:
> > > Hi Steph,
> > >
> > > as the name suggests, use LIMIT ;)
> >
> > AFAIK it's mysql specific (at least it does not work with mssql)
> >
> > --
> > Henrik Hansen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]