Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change text color

    Hi all,

    I am not new to PHP but i get my way even if it takes time

    I am busy with a project where i call a DOUBLE value from a mysql database every 5sec.

    I need to check if the value is above 0 or below 0.

    If the value is above 0, the font color should be BLUE and if below 0, the font color must be red.

    I will post my next issue when this one is resolved.

    I appreciate any help!

    Jannie

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    335
    Thanks
    2
    Thanked 49 Times in 48 Posts
    That can be solved using PHP if else statements. Why don't you post the code you have come up with so far here so that we can help you.

  • #3
    New Coder
    Join Date
    Oct 2012
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could you please send me the code? So only we can move further which is next step.

  • #4
    Regular Coder
    Join Date
    Mar 2012
    Posts
    102
    Thanks
    2
    Thanked 5 Times in 4 Posts
    It would be something like this,


    if (value==0) {
    echo "<font color="blue">0</font>";
    }
    else {
    echo "<font color="red">1</font>";
    }


    i'm not to good with php but i would think it would be something like that.


  •  

    Posting Permissions

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