RE: [PHP] Displaying SELECT results

From: Date: Fri, 22 Mar 2002 02:33:50 +0000
Subject: RE: [PHP] Displaying SELECT results
Groups: php.general 
Request: Send a blank email to php-general+get-89634@lists.php.net to get a copy of this message
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:ccrane@inxdesign.com] Sent: Friday, March 22, 2002 1:31 PM To: php-general@lists.php.net 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

« previous php.general (#89634) next »