Guest User

Untitled

a guest
May 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.38 KB | None | 0 0
  1. $cnt = 1;
  2.                         /**This is the sql query**/
  3.                         $result10 = mysql_query("SELECT *
  4.                                 FROM employees
  5.                                 WHERE VEHICLE_ID = '0'
  6.                                     and STATUS = '1'
  7.                                 ORDER BY LAST_NAME
  8.                                
  9.                             ");
  10.                            
  11.                            
  12.                             #If no results are found, inform the user that all vehicles are accounted for
  13.                             if (db_num_rows($result10) == 0)
  14.                             {
  15.                                 echo "<font color=\"black\">All employees are accounted for.</font>";
  16.  
  17.                             } else {
  18.                                
  19.                                
  20.                                 /**Creating an html table to display the results of the query.
  21.                                     Table's opening and closing brackets must surround the calling of the function.
  22.                                     This allows the Result count to be on top of the table.**/
  23.                                                        
  24.                                 echo "
  25.                                
  26.                                 <tr style =\"border: 1px solid black; padding: 3px; \">
  27.                                
  28.                                 <th style =\"border: 1px solid black; padding: 3px;\"><b><font color =\"black\">Employee Number</font></b></th>
  29.                                 <th style =\"border: 1px solid black; padding: 3px; \"><b><font color =\"black\">First Name</font></b></th>
  30.                                 <th style =\"border: 1px solid black; padding: 3px; \"><b><font color =\"black\">Last Name</font></b></th>
  31.                                 <th style =\"border: 1px solid black; padding: 3px; \"><b><font color =\"black\">Assign a Vehicle</font></b></th>
  32.                                
  33.                                 </tr>
  34.                                 ";
  35.                                
  36.                                
  37.                                 while ($row = db_fetch_assoc($result10)) {
  38.                                    
  39.                                    
  40.                                     echo "<tr style =\"border: 1px solid black; padding: 3px;\">
  41.                                           <td style =\"border: 1px solid black; padding: 3px;\">".$row['EMP_ID']."</td>
  42.                                           <td style =\"border: 1px solid black; padding: 3px;\">".$row['FIRST_NAME']."</td>
  43.                                           <td style =\"border: 1px solid black; padding: 3px;\">".$row['LAST_NAME']."</td>
  44.                                           <td style =\"border: 1px solid black; padding: 3px;\"><a href=\"assign_vehicle.php?item_id=" . $row['id'] . "\" title=\"Assign a Vehicle\">Assign a Vehicle</a></td>
  45.                                           </tr>";
  46.                                    
  47.                                     //echo "<p><b>" . $cnt . ".</b> <a href=\"assign_vehicle.php?item_id=" . $row['id'] . "\" title=\"Assign a Vehicle\"> Employee: " . $row['EMP_ID'] . " " . $row['FIRST_NAME'] . " " . $row['LAST_NAME'] . " is not assigned a vehicle.</a></p>";
  48.                                     $cnt++;
  49.                                 }
  50.                                
  51.                                 echo "
  52.                                 <br />
  53.                                 <b><font color =\"Red\">Number of employees missing vehicles: ".$cnt."</font></b>";
  54.                             }
Add Comment
Please, Sign In to add comment