Jump to content

Custom Reports and $bgcolor


MACscr

Recommended Posts

I cant for the life of me get table row colors to work. here is a snippet of my report that assigns the colors. Any ideas?

 

  if ($percent_used > 90) {
     $bgcolor = "ff9999";
 } elseif ($percent_used > 70 && $percent_used < 1) {
     $bgcolor = "FFCC00";
 } elseif ($percent_used > 50 && $percent_used < 1) {
     $bgcolor = "fff47f";
 } elseif ($percent_used < 50) {
     $bgcolor = "fff47f";
 } else {
     $bgcolor = "ffffff";
 }

Link to comment
Share on other sites

The middle cases are wrong, you can't be greater than 70 and less than 1 at the same time, not in this universe anyways :P

 

I tend to leave off the > 1 stuff, as it doesn't add anything, and just write:

 

if ($percent_used > 90) {
     $bgcolor = "ff9999";
 } elseif ($percent_used > 70) {
     $bgcolor = "FFCC00";
 } elseif ($percent_used > 50) {
     $bgcolor = "fff47f";
 } else {
     $bgcolor = "ffffff";
 }

ps: it's always the thing, just need another pair of eyes to catch those pesky bugs ... get it myself all the time!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated