Re: Changing colors in table?
| From: | boclair | Date: | Tue, 01 Oct 2002 01:21:14 +0000 |
| Subject: | Re: Changing colors in table? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22118@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: Blue Tiger <bluetiger@mindspring.com>
To: <php-db@lists.php.net>
Sent: Tuesday, October 01, 2002 10:13 AM
Subject: RE: [PHP-DB] Changing colors in table?
: The blank table column comes from a blank MySQL database field...(I was
: initially going to blob images from there to show status change). If you
: know of a way to eliminate the database field and still show the status
: of the values in a web table, please point me in the right direction.
: >> I have a piece of code that displays an array from a MySQL table. One
: >> field in the table is blank (and is displayed as an empty column of
: >> cells) at the moment. I want to have the blank cells display an
: image,
: >> value, or change its background color based on whether the numerical
: >> values in the previous 4 fields meet certain criteria or not. Make
: >> sense? Maybe?
: >>
: >> An example of what I want to show:
: >> If table 2 has a value that is less than 5, then the last cell
: > displayed
: >> changes color to reflect that.
: >> If table 2 has a value that is between 5 and 10, then the last cell
: >> displayed changes color to reflect that as well.
Ryan,
I understand you want to display the results of a db query in an html
table. Maybe I misunderstand but it seems that this shouldn't be done by
fiddling with the database table; fiddle with the html table instead
open mysql server
do select $result
start while loop on mysql-fetch-array($result) {
set
$summedfields = (sum field values);
if ($summedfields == 2) {
$bgclr="red";
}
else {
$bgclr="blue";
}
if ($blankfield == NULL) {
$blankfield = "<img src='image.gif' etc>";
}
iterate on table row
use $blankfield and $bgclr as values the html table data cells
e&oe
Louise