bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
|
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
1 |
<?php
|
2 |
function displayTable($tableName, $pdo){ |
|
3 |
$querystring = "SELECT * FROM ".$tableName; |
|
4 |
$stmt = $pdo->prepare($querystring); |
|
5 |
$stmt->execute(); |
|
6 |
$result=$stmt->fetchAll(PDO::FETCH_ASSOC); |
|
7 |
echo "<table class='dataTable'>"; |
|
8 |
echo "<caption>".$tableName."</caption>"; |
|
9 |
if(count($result)>0){ |
|
10 |
echo "<tr>"; |
|
11 |
foreach($result[0] as $key=>$data){ |
|
12 |
echo "<th>".$key."</th>"; |
|
13 |
}
|
|
14 |
echo "</tr>"; |
|
15 |
foreach($result as $row){ |
|
16 |
echo "<tr>"; |
|
17 |
foreach($row as $data){ |
|
18 |
echo "<td>".htmlspecialchars($data,ENT_QUOTES,'UTF-8')."</td>"; |
|
19 |
}
|
|
20 |
echo "</tr>"; |
|
21 |
}
|
|
22 |
} else { |
|
23 |
echo "<tr>"; |
|
24 |
echo "<td> Table empty </td>"; |
|
25 |
echo "</tr>"; |
|
26 |
}
|
|
27 |
echo "</table>"; |
|
28 |
}
|
|
29 |
||
30 |
$content="data/displayData.html.php"; |
|
31 |
?>
|