title: php show red colour div if date is within 7 days, else show other colour div?
body: <p>I have a script that tells the user when something is about to expire in the database, so for instance if something expires on the 20th april, and today is the 15th, then it will tell the user there are 5 days left until it expires.</p>
  
  <p>Now i want to add to my script to say if there are 7 days or less till expire date, then show a red coloured div, else if there are less than 30 days but more than 7, show a yellow coloured div, and otherwise if there are more than 30 days left till something expires, show a green coloured div.</p>
  
  <p>can someone please show me what i could do, thanks</p>
  
  <pre><code>&lt;?php 
      include 'config.php';
      $data = mysql_query("SELECT TIMESTAMPDIFF(DAY, insurance_date, NOW()) AS expire_date
                              FROM supplier_stats") or die(mysql_error());
  ?&gt;
  
  &lt;?php 
      include 'config.php';
      $result = mysql_query("SELECT TIMESTAMPDIFF(DAY, insurance_date, NOW()) AS expire_date 
                               FROM supplier_stats") or die(mysql_error()); 
      while($row = mysql_fetch_array($result)) 
      {
          $days = $row['expire_date'] -1;
          if ($days &gt; 0)
          {
              echo "&lt;p&gt;Insurance expires in &lt;font color=\"red\"&gt;{$row['expire_date']} day(s)!&lt;/font&gt;&lt;/p&gt;"; 
          }
          else
          {
              $when = $days*-1;           
              echo "&lt;p&gt;Insurance expires";
              if ($when &gt; 1){
                  echo " in {$when} days&lt;/p&gt;";
              }
              elseif ($when ===1)
              {
                  echo " tomorrow&lt;/p&gt;";
              }
              elseif ($when &gt; 0)
              {
                  echo " today&lt;/p&gt;";
              }
          }
      } 
  ?&gt;
  </code></pre>