Re: [PHP-DB] SELECT & html

Mon, 05 Dec 2005 04:23:48 -0800

On Sun, 2005-12-04 at 13:38 -0500, Ron Piggott (PHP) wrote:
> I have two questions.  
> 
> I would like to display the contents of my table with the first row
> being grey in background and the next row being white and the third row
> being grey, fourth being white, etc.  I am not sure how to do this.

Cool. You must use CSS for this. Your PHP must dish out <tr> tags with
alternating CSS classes... this allows you to change colors later
without editing code. This done, now for dishing out <tr> tag with
alternating classes you can use a function built along the following
lines:

function showRow() {
    static $row = 1;
    print("<tr class=\"rCol$row\"> Your HTML Row goes here. </tr>");

    if (2 == $row) {
        $row--;
    }
    else {
        $row++;
    }
}

> 
> Secondly I only want the first 20 records to be displayed at a time and
> then I want to create a "NEXT" link for the next 20 records (21-40) ...
> any idea how you would use the SELECT command to do this?

This should be plain simple... Try reading more about SELECT. You need
to use the LIMIT clause with SELECT.

Have fun,

ah

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

Reply via email to