/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1

« back to all changes in this revision

Viewing changes to trunk/DuggaSys/quizSystem/data/index.php

  • Committer: Henrik G.
  • Date: 2013-03-26 23:22:55 UTC
  • Revision ID: henrik.gustavsson@his.se-20130326232255-ik6snyatlbkf3zs1
First seed of Lenasys ... Needs to be Organized Further

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
?>
 
 
b'\\ No newline at end of file'