Hiya I have a dynamic table and am trying to get the rows to be two
different alternate colours. well Ive looked at a couple of snippets of this
colour code and previous mails regarding this. Im having major troubles
intergrating any of these suggestions with my code. Can anyone suggest where
At 22:14 5-4-2003, you wrote:
Hiya I have a dynamic table and am trying to get the rows to be two
different alternate colours. well Ive looked at a couple of snippets of
this colour code and previous mails regarding this. Im having major
troubles intergrating any of these suggestions with my
sorry i see i made a bit too many ambiguous typing errors.
Hiya I have a dynamic table and am trying to get the rows to be two
different alternate colours. well Ive looked at a couple of snippets of
this colour code and previous mails regarding this. Im having major
troubles intergrating any
( $row = mysql_fetch_array($db_result) )
{
echo(
tr $c
td . $row['bugid'] . /td
/tr
);
if ( !isset($c) )
{
$c = bgcolor=#FF;
echo $c;
}
else
{
unset($c);
}
}
From: Chris Hayes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [PHP] RE: newbie alternate row colours in dynamic
]; [EMAIL PROTECTED]
Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table
Hiya people
After a lot of soul searching, exploring the web and help
from many people I
came up with this simple solution:
Thank you Chris for explaining the toggle $colorset. In the
end I
At 00:42 6-4-2003, you wrote:
Wow you guys are going about that way more complicated than it needs to
be:
$i = 0;
echo TR BGCOLOR='#. (($i++ % 2 == 0) ? 'E3E3E3 : FF) .';
Then it just alternates and takes care of itself (plus you get a nice
little index counter as well as a bonus if you want
On 05-Apr-2003 Bobby Rahman wrote:
Hiya people
After a lot of soul searching, exploring the web and help from many
people I
came up with this simple solution:
Okey-doke. simple is in the eye of the beholder.
$bgcolor = ($bgcolor == '#E3E8F0' ? '#C7D0E2' : '#E3E8F0');
snip
I had to know... ;-)
Output:
version one:0.56761503219604 seconds
version two:0.3099730014801 seconds
version three: 0.36320495605469 secondss
So the boolean (V2)is faster:
Mine is slightly slower by a 'smidge' (0.06 seconds)
Top one is cleanest but slower.
--- test ---
?php
If you really want to be optimal, use bitwise instead
of modulus :) And ++$i instead of $i++ :) And,
use single not double quotes :) Silly, but true.
http://www.faqts.com/knowledge_base/view.phtml/aid/783/fid/9
And, write less code, so:
$bgcolor = (++$i 1) ? '#ff' : '#ee';
]
Subject: RE: [PHP] RE: newbie alternate row colours in dynamic table
--
timed tests
If you really want to be optimal, use bitwise instead
of modulus :) And ++$i instead of $i++ :) And,
use single not double quotes :) Silly, but true.
http://www.faqts.com/knowledge_base/view.phtml/aid
10 matches
Mail list logo