Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. //Ajout des vues & modèles
  4. include("vue_index.php");
  5. include("php/_MVC_/config.php");
  6. include("php/_MVC_/modele.php");
  7. include("php/_MVC_/session.php");
  8. include("php/_MVC_/dictionnary.php");
  9.  
  10. // starts/keep the session
  11. session();
  12.  
  13. //creating the page
  14. head(getlg($_SESSION["lang"],"title-header-index"));
  15. navigationbar();
  16.  
  17. // test the database connection
  18. try {
  19.     $user = 'tp_web';
  20.     $pass = 'tp_web';
  21.     $dbh = new PDO('pgsql:host=localhost;dbname=tp_web', $user, $pass);
  22.  
  23.     $tableRows = [];
  24.     foreach ($dbh->query("SELECT (last_name, first_name, age) FROM users WHERE first_name='Jean';") as $row) {
  25.         $tableRows[] = $row[0];
  26.     }
  27.     $dbh = null;
  28. } catch (PDOException $e) {
  29.     print "Error!: " . $e->getMessage() . "<br/>";
  30.     die();
  31. }
  32. echo "
  33. <div class=\"container\"></div>
  34.    <h3>DB's results !!! \o/</h3>
  35.    <table class=\"table table-bordered table-hover table-striped\">
  36.    ";
  37.         foreach ($tableRows as $row) :
  38.         echo "<tr>";
  39.             echo "<td>"; echo $row; echo"</td>";
  40.         echo "</tr>";
  41.         endforeach;
  42.     echo "</table>
  43. </div>
  44. ";
  45.  
  46. echo $_SESSION["lang"];
  47. echo $Dico["Home"];
  48. echo $Dico["Home"][1];
  49. echo $_SESSION["lang"]["Home"];
  50. echo ($_SESSION["lang"])["Home"];
  51.  
  52. foot();
  53.  
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement