/
nomenc_contenance.php
72 lines (49 loc) · 1.58 KB
/
nomenc_contenance.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
70
71
72
<?php
$page_title = "Nomenclatures des contenances";
include_once "header.php";
?>
<?php
// page given in URL parameter, default page is one
$page = isset($_GET['page']) ? $_GET['page'] : 1;
// set number of records per page
$records_per_page = 15;
// calculate for the query LIMIT clause
$from_record_num = ($records_per_page * $page) - $records_per_page;
// include database and object files
include_once 'config/database.php';
include_once 'objects/Contenance.php';
// instantiate database and product object
$database = new Database();
$db = $database->getConnection();
$contenance = new Contenance($db);
// query products
$stmt = $contenance->readAll($page, $from_record_num, $records_per_page);
$num = $stmt->rowCount();
// display the products if there are any
if($num>0){
echo "<table class='table table-striped table-hover table-responsive'>";
echo "<tr>";
echo "<th>Nom</th>";
echo "<th>Volume</th>";
echo "<th>Equivalence</th>";
echo "</tr>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
echo "<tr>";
echo "<td>{$nom}</td>";
echo "<td>{$volume}</td>";
echo "<td>{$equivalence}</td>";
echo "</tr>";
}
echo "</table>";
// paging buttons here
include_once 'paging/paging_contenance.php';
}
// tell the user there are no products
else{
echo "<div>Aucun cépage trouvé</div>";
}
?>
<?php
include_once "footer.php";
?>