All pastes #129486 Raw Edit

Unnamed

public text v1 · immutable
#129486 ·published 2006-08-13 15:04 UTC
rendered paste body
<?php
for ($id=1; $id<=4; $id++)
  {	
    //what lab?
    if ($id == '1')
      $lab = 'Cedar';
    if ($id =='2')
      $lab = 'Maple';
    if ($id == '3')
      $lab = 'Oak';
    if ($id == '4')
      $lab = 'Spruce';
      	      
    //Title
    echo "<b>".$lab." Printer Inventory</b><br/>";
          
    $result=mysql_query("SELECT user, ink, toner, Date, Time FROM inventory where id='$id'")or die(mysql_error());
    while($row = mysql_fetch_object($result))
    {       
      //time
      echo "<i>Last Updated on: ".$row->Date." at ".$row->Time. " by ".$row->user.".</i>";
      echo "<br/>"; 
          
      //Paper
      if ($lab == 'Oak' || $lab == 'Maple')
      {  

        $newInk = (11-$row->ink);
        echo "Paper needed: ";

        echo ($newInk);
        echo "<br/>";
      }
     	    
      if ($lab == 'Cedar' || $lab == 'Spruce')
      {

        $newInk = (15-$row->ink);
        echo "Paper needed: ";

        echo ($newInk);
        echo "<br/>";
      }
     	    	  
      //toner

      $newToner = (1-$row->toner);
      echo "Toner needed: ";

      echo ($newToner);

      echo '<p/>';
    }
  }
?>