Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cnt = 1;
- /**This is the sql query**/
- $result10 = mysql_query("SELECT *
- FROM employees
- WHERE VEHICLE_ID = '0'
- and STATUS = '1'
- ORDER BY LAST_NAME
- ");
- #If no results are found, inform the user that all vehicles are accounted for
- if (db_num_rows($result10) == 0)
- {
- echo "<font color=\"black\">All employees are accounted for.</font>";
- } else {
- /**Creating an html table to display the results of the query.
- Table's opening and closing brackets must surround the calling of the function.
- This allows the Result count to be on top of the table.**/
- echo "
- <tr style =\"border: 1px solid black; padding: 3px; \">
- <th style =\"border: 1px solid black; padding: 3px;\"><b><font color =\"black\">Employee Number</font></b></th>
- <th style =\"border: 1px solid black; padding: 3px; \"><b><font color =\"black\">First Name</font></b></th>
- <th style =\"border: 1px solid black; padding: 3px; \"><b><font color =\"black\">Last Name</font></b></th>
- <th style =\"border: 1px solid black; padding: 3px; \"><b><font color =\"black\">Assign a Vehicle</font></b></th>
- </tr>
- ";
- while ($row = db_fetch_assoc($result10)) {
- echo "<tr style =\"border: 1px solid black; padding: 3px;\">
- <td style =\"border: 1px solid black; padding: 3px;\">".$row['EMP_ID']."</td>
- <td style =\"border: 1px solid black; padding: 3px;\">".$row['FIRST_NAME']."</td>
- <td style =\"border: 1px solid black; padding: 3px;\">".$row['LAST_NAME']."</td>
- <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>
- </tr>";
- //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>";
- $cnt++;
- }
- echo "
- <br />
- <b><font color =\"Red\">Number of employees missing vehicles: ".$cnt."</font></b>";
- }
Add Comment
Please, Sign In to add comment