duncan121 Posted April 6, 2006 Share Posted April 6, 2006 I have an alternative color row problem. I am quite familiar with the normal alternative color rows. But I have multiple rows with same user so I wanted to highlight all the same users in the same color.Please the example below.Mr Smith = yellowMr Smith = yellowMr Smith = yellowMr West = redMr West = redMr White = yellowMr White = yellowAnd so on….Any help would be warmly appreciated Link to comment https://forums.phpfreaks.com/topic/6755-multiple-alternative-color-row/ Share on other sites More sharing options...
lead2gold Posted April 6, 2006 Share Posted April 6, 2006 [code]$bgcolor ="yellow";$lastname = "";while ($row={fetching array information}){ if($row[name] != $lastname){ $lastname=$row[name]; $bgcolor = ($bgcolor=="yellow")?"red":"yellow"; } // bg color will always alter on a name change echo $bgcolor;}[/code] Link to comment https://forums.phpfreaks.com/topic/6755-multiple-alternative-color-row/#findComment-24564 Share on other sites More sharing options...
duncan121 Posted April 6, 2006 Author Share Posted April 6, 2006 [!--quoteo(post=362331:date=Apr 6 2006, 07:23 PM:name=lead2gold)--][div class=\'quotetop\']QUOTE(lead2gold @ Apr 6 2006, 07:23 PM) [snapback]362331[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]$bgcolor ="yellow";$lastname = "";while ($row={fetching array information}){ if($row[name] != $lastname){ $lastname=$row[name]; $bgcolor = ($bgcolor=="yellow")?"red":"yellow"; } // bg color will always alter on a name change echo $bgcolor;}[/code][/quote]Works a treat...Thanks Link to comment https://forums.phpfreaks.com/topic/6755-multiple-alternative-color-row/#findComment-24627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.