aboutsummaryrefslogtreecommitdiffstats
path: root/list-scroll.php
blob: c69ed20d2a84e00d4b22dadef4b4591728f297cf (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link rel="stylesheet" type="text/css" href="../css/table.css">
<title></title>
</head>
<body>
<a href="add.php" class="stb">Add Record</a><br><br><br>
<?php

include '/home/kb0iic/config.inc';

$name = '$_POST[Pkgname]';
//$name = 'linux-headers';

$sql = 'SELECT id, seq, name, version, configure, build, install, notes, url FROM PKG, PKG_CFG, PKG_BLD, PKG_NST, PKG_NOT, PKG_URL WHERE PKG_CFG.pkg_id = PKG.id AND PKG_BLD.pkg_id = PKG.id AND PKG_NST.pkg_id = PKG.id AND PKG_NOT.pkg_id = PKG.id AND PKG_URL.pkg_id = PKG.id';

try {
	$stmt = $pdo->prepare($sql);
	$stmt->execute();
} catch (PDOException $e) {
	if ($e->getCode() == 1062) {
		// Take some action if there is a key constraint violation,
		// i.e. duplicate name
		print $e->getMessage();
	} else {
		echo "<pre>Have a big problem</pre>";
		throw $e;
	}
}

if ($stmt->rowCount() > 0) {

	// Data received
	
	// Start Table
	$html_table = '<div id="constrainer"><div class="scrolltable">';

	// Table Header
	$html_table .= '<table class="header">';
	$html_table .= '<thead><th>SEQ</th><th>NAME</th><th>VERSION</th>';
	$html_table .= '<th>CONFIGURE</th><th>BUILD</th><th>INSTALL</th>';
	$html_table .= '<th>NOTES</th><th>URL</th><th>EDIT</th></thead>';
	$html_table .= '</table>';

	// Body
	$html_table .= '<div class="body"><table><tbody>';

	// Table Rows
	while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
		$html_table .= '<tr>';
		$html_table .= '<td><a name="'.$row['seq'].'">'.$row['seq'].'</a></td>';
		$html_table .= '<td>'.$row['name'].'</td>';
		$html_table .= '<td>'.$row['version'].'</td>';
		$html_table .= '<td>'.nl2br($row['configure']).'</td>';
		$html_table .= '<td>'.nl2br($row['build']).'</td>';
		$html_table .= '<td>'.nl2br($row['install']).'</td>';
		$html_table .= '<td>'.nl2br($row['notes']).'</td>';
		$html_table .= '<td>'.nl2br($row['url']).'</td>';
        $html_table .= "<td><a href='edit.php?id=".$row['id']."'class=\"stb\">Edit</a></td>";
		$html_table .= '</tr>';
	}

	// End Table
	$html_table .= '</tbody></table></div></div></div>';

} else {
	// No Data received
    echo "<pre>Nothing!</pre>";
}

$html_table .= '</table>';
echo $html_table;

?>
<!--- w3c tag -->
<p align="right">
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
</p>
<!-- end w3c tag -->
</body>
</html>