Results 1 to 3 of 3

Thread: Text to show in different colours
      
   

  1. #1
    Join Date
    Nov 2006
    Location
    Centurion, South Africa
    Posts
    586

    Question 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 at 02:41 PM. Reason: wrong address

  2. #2
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default 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

  3. #3
    Join Date
    Nov 2006
    Location
    Centurion, South Africa
    Posts
    586

    Default 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •