-
Notifications
You must be signed in to change notification settings - Fork 1
/
expdesktop.php
69 lines (59 loc) · 2.34 KB
/
expdesktop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?
//
# Expired Desktops Report
# Written by Darrell James Breeden ([email protected]) for SATO America
#
# Released 08-OCT 2010
# This program is free software licensed under the
# GNU General Public License (GPL).
#
# This file is part of Its Assets.
#
# SimpleAssets is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# SimpleAssets is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SimpleAssets; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA
//
$con = mysql_connect("localhost","root","louro123");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("simpleassets", $con);
$query="SELECT Assets.name,Assets.AssetTag,Assets.AssetSupplier,Assets.AssetModel,CONCAT(Employees.FirstName,', ',Employees.LastName) AS Employee, date(Assets.exp_date) AS Edate FROM Assets INNER JOIN Assignments on Assignments.AssetId = Assets.Id INNER JOIN Employees on Employees.Id = Assignments.EmployeeId WHERE Assignments.EndDate = 0 AND date(Assets.exp_date) <= curdate() AND Assets.AssetType='Desktop' ORDER BY Assets.name";
$result = mysql_query($query);
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<h1>Desktops Requiring Replacement {$table}</h1>";
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
mysql_close($con);
?>