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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to show the Status of the values in database similar to Booking Tickets in online

    U might have see in online ticket reservation status..the reservation of the seats status is showed in different colors according to the change in database values.lik that consider 9 vehicles status in a matrix lik format..according to database values of the vehicles such as the compaction level the cells should be shown in different colors

    Example
    Vehicle ID Compaction Level
    1 68
    2 40
    3 80
    4 70
    5 20
    6 52
    7 90
    8 87
    9 62

    This are the threshold levels >80 (Threshold color is green), >50(color is blue) , <50(color is red)
    How to do this in php...please help me out...need it urgent

  • #2
    New Coder
    Join Date
    May 2012
    Posts
    50
    Thanks
    6
    Thanked 4 Times in 4 Posts
    Just set a class (css) on lets say the span holding your value.

    Quick example:
    PHP Code:

    $valueDatabase 
    80;
    // Code above this is where you get the value(s) from your database

    if($valueDatabase 80) {
        echo 
    '<span class="green">'.$valueDatabase.'</span>';
    } else if(
    $valueDatabase 50) {
        echo 
    '<span class="blue">'.$valueDatabase.'</span>';
    } else {
        echo 
    '<span class="red">'.$valueDatabase.'</span>';



  •  

    Posting Permissions

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