1)
        a) you know which page you're on (default to 1)
        b) count = "select count(*)" from database
        c) num_pages = count / num_items_per_page
        d) display accordingly

2)
        start loop (has some counter, eg $i)
                $bgcol = "white";  if ($i % 2 == 1)  $bgcol = "gray";
                rest of code
        end loop

-----Original Message-----
From: Christopher J. Crane [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 1:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Displaying SELECT results


I wrote a shopping cart, but I
don't understand two things.
1) What is the best way to display like the first ten records and then a
list of how many pages with 10 records on them...similar to like a search
engine when it returns it's results. If I have 100 items I do not want to
display all of them on one page. So I will display the first ten, and then a
link for the next ten or something like that. I did this in PERL, but it was
a long mathematical routine to get it and I know there must be an easier
way.

2) To display the results of a SELECT statement, but every other line is a
off color. So Like row 1 is white and row 2 is gray and row 3 is white and
row 4 is gray and so one.




-- 
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