Display icon if database value exeed some limit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    Display icon if database value exeed some limit

    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?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    [php]
    if($_waterfall_ measurement > 200)
    {
    echo "<img src='exceeded.j pg' />";
    }
    else
    {
    echo "<img src='green.jpg' />";
    }
    [/php]

    Just use an if statement :)
    If the measurement is greater than 'whatever', show relevant image.

    Regards

    Comment

    • ghjk
      Contributor
      • Jan 2008
      • 250

      #3
      Originally posted by markusn00b
      [php]
      if($_waterfall_ measurement > 200)
      {
      echo "<img src='exceeded.j pg' />";
      }
      else
      {
      echo "<img src='green.jpg' />";
      }
      [/php]

      Just use an if statement :)
      If the measurement is greater than 'whatever', show relevant image.

      Regards



      This is what i have done. I want to get the value which exceed threshold value. how can i do that?[PHP]$qq = mysql_query("SE LECT Rainfall_ID,Sta tion_ID,Rainfal l FROM rainfall ORDER BY Rainfall_ID");
      while($row = mysql_fetch_arr ay($qq)){
      foreach( $row AS $key => $val ){
      $$key = stripslashes( $val );
      }
      echo "$Station_ID".' ,'."$Rainfall" ;

      }

      $qq = mysql_query("SE LECT Station_ID,Thre shold_Val FROM station ORDER BY Station_ID");
      while($row = mysql_fetch_arr ay($qq)){
      foreach( $row AS $key => $val ){
      $$key = stripslashes( $val );
      }
      echo "$Station_ID".' ,'."$Threshold_ Val";
      }[/PHP]

      Comment

      Working...