When I've done this in the past I've always handled alternating colours in the web scripting side. You have to loop through all the records to display them from the query, so I maintain a 'current record count'. If it's odd, format the row white, if it's even format the row grey.

For example in php:

<?
        $count = 0;
        while ($row = sqlite_fetch_array($res))
{
?>
        <tr>
        <td <? if (($count%2)==0) echo "class=\"even\""; ?>>results
        </tr>
<?
        $count = $count + 1;
}
?>

In this example, the CSS class even formats the table row grey.

Gary

Randall Fox wrote:
Is there an easy way to have an "alternating" column value in a query,
using sqlite ?

I want to have a column that alternates its value on every row.  The
application is web based.  I want to alternate colors for each row in
a table..  Something  row1 = gray background, row2 = white, row3=grey,
row4 = white, etc...


Thanks

Randall Fox

Reply via email to