-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample2.php
More file actions
53 lines (42 loc) · 1.01 KB
/
Example2.php
File metadata and controls
53 lines (42 loc) · 1.01 KB
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
<html>
<head>
<style>
table {
border: 2px solid #888888;
border-collapse: collapse;
}
th, td {
border: 1px solid #999999;
}
</style>
</head>
<body>
<?php
require "Data_Table.php";
require "SQL_Object.php";
$id_link = mysql_connect("localhost", "root", "");
mysql_select_db("testing");
$table = new Data_Table();
$table->headerRepeat = 30;
$sql = "SELECT * FROM equipment";
$query = new SQL_Object($sql);
$keys = $query->data[0];
$columns = count($keys);
$header = array();
foreach ($keys as $key => $value) {
$header[$key] = $key;
}
$table->addHeader($header);
foreach ($query as $key => $value) {
$table->addRow($value);
}
//$table->sort("SN");
$table->table->setAttribute_r("width", "width", floor(100 / ($columns-1)) . "%", array("td", "th"));
$table->table->setAttribute_r("align", "center", floor(100 / ($columns-1)) . "%", array("td", "th"));
foreach ($table->tr as $row) {
//$row->setAttribute_r("width", "width", floor(100 / $columns) . "%", array("td", "th"));
}
echo $table->generate();
?>
</body>
</html>