Display icon if database value exeed some limit

Discussion in 'PHP' started by ghjk, Mar 26, 2008.

  1. #1
    My php application i want to display a icon when it exeed some value. Eg: I have rainfall values in my database and if some value exeed the given higher limit the icon sholud display on my web page. How can i do that?
     
    ghjk, Mar 26, 2008 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    can you elaborate? what rainfall values?
     
    bartolay13, Mar 26, 2008 IP
  3. unknowngiver

    unknowngiver Peon

    Messages:
    94
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    are you able to read the data from your database? or do you need the entire php code to connect to the database, read the value, compare it and then display the picture
    if you are able to read the value already then its just a matter of comparing it with your value like so:
    
    $database_value; // The value read from the database!
    $comparison = 12; //if you want the number that you want to compare with to be 12 
    if ($comparison > $database_value) {
    echo "<img src='img url of if number exceeds'/>";
    }
    
    Code (markup):
     
    unknowngiver, Mar 26, 2008 IP
  4. ghjk

    ghjk Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    How can i compare it?
     
    ghjk, Apr 1, 2008 IP
  5. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #5
    use left join

    sample

    select t1.*,t2.* from tableone as t1 left join tabletwo as t2 on t1.id = t2.id order by rainfall
     
    bartolay13, Apr 13, 2008 IP