Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- </html>
- <?php
- if (isset($_POST['Code_postal'])){$Code_postal=$_POST['Code_postal'] ;}
- if (isset($_POST['Gouvernorat'])){$Gouvernorat=$_POST['Gouvernorat'] ;}
- if (isset($_POST[' delegation '])){$délégation=$_POST[' delegation '];}
- echo "<table style='border: solid 1px black;'>";
- echo "<tr><th>activit</th><th>Address</th><th>Localit</th><th>delegation</th></th><th>Gouvernorat</th></tr>";
- class TableRows extends RecursiveIteratorIterator {
- function __construct($it) {
- parent::__construct($it, self::LEAVES_ONLY);
- }
- function current() {
- return "<td style='width:200px;border:1px solid black;'>" . parent::current(). "</td>";
- }
- function beginChildren() {
- echo "<tr>";
- }
- function endChildren() {
- echo "</tr>" . "\n";
- }
- }
- $DBSERVER='localhost';
- $DBUSER='user';
- $DBPASS='user';
- $DBNAME='viamobile1';
- try {
- $conn = new PDO("mysql:host=$DBSERVER;dbname=$DBNAME", $DBUSER, $DBPASS);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $conn->prepare("SELECT * FROM viamobile");
- $stmt->execute();
- // set the resulting array to associative
- $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
- foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) {
- echo $v;
- }
- }
- catch(PDOException $e) {
- echo "Error: " . $e->getMessage();
- }
- $conn = null;
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement