Great! I think that's the SQL function I needed.

Now for the PHP part - I'm a bit fo a newbie at writing code, so bear 
with me here. My query string is currently something like:

$sql = mysql_query("SELECT * FROM mytable WHERE color=$color");

So I would modify that to read:

$sql = mysql_query("SELECT * FROM mytable WHERE color=$color LIMIT $i, 
25");

Where $i = 1 To get just the first 25 records. I think I'm confused on 
how to set $i and create links. Would I just initially set $i = "1"; 
then make links that point to:

myscript.php?color=red&i=25

Then have a $_GET['i'] variable in my script and set $i equal to that?

Your help is appreciated. Thanks again.

Jason Soza

----- Original Message -----
From: "Kevin Stone" <[EMAIL PROTECTED]>
Date: Thursday, May 16, 2002 10:53 am
Subject: Re: [PHP] Making Multiple Pages

> $query = "SELECT * FROM mytable LIMIT $i, 20";
> 
> Where 20 is the number of rows to retrieve and $i is the starting row.
> 
> By incrementing $i + 20 you can do next, prev buttons, or parse 
> the total
> number of rows into page links (prev - 1, 2, 3, 4, 5, 6.. 10.. 20 -
> next).
> 
> Search www.mysql.com for more information about using LIMIT in 
> your queries.
> 
> -Kevin
> 
> ----- Original Message -----
> From: "Jason Soza" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 16, 2002 12:31 PM
> Subject: [PHP] Making Multiple Pages
> 
> 
> > I have some ideas on how this should be done, but I'm at work 
> and can't
> > really test them, so I was thinking maybe I could run it by you 
> all and
> > maybe get some feedback and/or new ideas.
> >
> > I have a PHP/MySQL-generated page that displays image thumbnails.
> > Currently, I have a loop that makes a table and table rows, 
> fills the
> > rows with the thumbnails, then when there's no more information, it
> > completes whatever row it's on with blank <td>'s, then closes 
> the table.
> >
> > This was working fine, but my site is actually attracting more 
> traffic> than I originally thought, and I'm getting more image 
> submissions. It's
> > getting to where it's no longer practical to arrange all the 
> thumbnails> onto one page, I need to have like 25 on one page, 
> then have the script
> > create a link at the bottom so users can click and see the next 25.
> >
> > I'm thinking I need to use some kind of row count language in the
> > script, i.e. first count how many rows are in the MySQL table, 
> if it's
> > less than 25, just display them all. If there's more than 25, 
> display> only 1 - 25, then create a link to view 26 - 50, etc.
> >
> > Is that what I need to be looking into? Any other ideas would be
> > appreciated. Thanks!
> >
> > Jason Soza
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to