Text to show in different colours

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rob (SA)
    Lieutenant Colonel

    • Nov 2006
    • 586

    Text to show in different colours

    Hi folks,

    I have a page that poulates from MySql and it populates with numbers.

    Can be veiwed at www.gnjgf.co.za/stevie/doom1.php


    I also have a script (Css) that affects the colours and look generally.

    My question is this:

    How do I go about getting the values to appear so:

    Numbers less than 72 to show in red
    the number 72 to show as blue and
    the remaining numbers to show black.

    I would appreciate that someone knowing to do this please provide me with the know how or script - please
    Last edited by Rob (SA); 08-28-2009, 02:41 PM. Reason: wrong address
    Kind Regards
    Rob
    www.gnjgf.co.za
    www.oryan-projects.com
  • Watdaflip
    Major General

    • Sep 2005
    • 2116

    #2
    Re: Text to show in different colours

    Just use an if statement

    if($number < 72)
    echo '<span style="color: FF0000">'.$number.'</span>';
    else
    echo '<span style="color: 0000FF">'.$number.'</span>';

    Or you can assign a class to it instead of directly assigning the color

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

    Comment

    • Rob (SA)
      Lieutenant Colonel

      • Nov 2006
      • 586

      #3
      Re: Text to show in different colours

      Hi,

      Thanks for the response.

      I have managed to get it to work - see www.gnjgf.co.za/stevie/doom1.php
      Kind Regards
      Rob
      www.gnjgf.co.za
      www.oryan-projects.com

      Comment

      Working...
      X