Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. <?php
  2. // Pour que toutes les erreurs et les warnings soient affichés
  3. error_reporting (E_ALL);
  4. ini_set ('display_errors' , 1);
  5.  
  6. $connect=mysqli_connect('localhost','esteve3u','Nei1oob0ro','esteve3u_1') or die(mysqli_connect_error($connect));
  7.  
  8. $okcharset=mysqli_set_charset($connect,'Utf8');
  9.  
  10. if (isset($_GET['critere']))
  11. {
  12. $critere = $_GET['critere'];
  13. }
  14. else {
  15. $critere = "nomb";
  16. }
  17.  
  18. $req="SELECT * FROM `immo_biens`,`immo_categories` WHERE `immo_biens`.categorieb = `immo_categories`.idc ORDER BY $critere";
  19.  
  20. $resSQL=mysqli_query($connect,$req) or die(mysqli_error($connect));
  21.  
  22. $okdeco=mysqli_close($connect);
  23. ?>
  24. <!doctype html>
  25. <html lang="fr">
  26.  
  27. <head>
  28. <meta charset="utf-8">
  29. <title>Titre de la page</title>
  30.  
  31. <meta name="author" content="Jean-Luc Husson" />
  32. <meta name="keywords" content="Exercice,html,PHP" />
  33. <meta name="description" content="formulaire de saisie des courses" />
  34. <link type="text/css" rel="stylesheet" href="devweb_styles.css" media="screen" />
  35.  
  36. <!-- ========================================================= -->
  37. <!-- les liens vers les éventuelles feuilles de style externes -->
  38. <!-- ========================================================= -->
  39.  
  40. <link rel="stylesheet" type="text/css" href="devweb_styles.css" />
  41.  
  42.  
  43. <!-- ========================================================= -->
  44. <!-- Eventuel style css interne -->
  45. <!-- ========================================================= -->
  46.  
  47. <style type="text/css">
  48.  
  49. /* Ici votre code CSS interne */
  50.  
  51. body {
  52.  
  53. }
  54.  
  55. </style>
  56.  
  57. </head>
  58.  
  59. <body>
  60.  
  61.  
  62. <!-- ========================================================= -->
  63. <!-- Le contenu HTML de la page -->
  64. <!-- ========================================================= -->
  65.  
  66. <?php
  67.  
  68. // votre code PHP
  69.  
  70. $nbMaisons=mysqli_num_rows($resSQL);
  71.  
  72. echo '<div><h1>Version 1 / Nombre de bien: '.$nbMaisons.' </h1></div>';
  73.  
  74.  
  75.  
  76. echo '<table>';
  77.  
  78. echo '<tr>';
  79. echo ('<th>Photo</th>');
  80. echo ('<th><a href="index3.php?critere=categorieb">Categorie</a></th>');
  81. echo ('<th><a href="index3.php?critere=nomb">Nom</a></th>');
  82. echo ('<th><a href="index3.php?critere=surfaceb">Surface</a></th>');
  83. echo ('<th><a href="index3.php?critere=codeenergieb">Code energie</a></th>');
  84. echo ('<th><a href="index3.php?critere=prixb">Prix</a></th>');
  85. echo ('<th><a href="index3.php?critere=chambreb">Nombre chambre</a></th>');
  86.  
  87. echo '</tr>';
  88.  
  89.  
  90. for($num=1;$num<=$nbMaisons;$num++){
  91. $tab=mysqli_fetch_array($resSQL);
  92. $nomMaison=$tab['nomb'];
  93. $prixMaison=$tab['prixb'];
  94. $mediaMaison=$tab['mediab'];
  95. $surfMaison=$tab['surfaceb'];
  96. $nombChambMaison=$tab['chambreb'];
  97. $codeMaison=$tab['codeenergieb'];
  98. $catMaison=$tab['nomc'];
  99. echo '<tr>';
  100. echo ('<td class="coul1"><img src="medias/'.$mediaMaison.'"/></td>');
  101. echo ('<td class="coul1")>'.$catMaison.'</td>');
  102. echo ('<td class="coul2">'.$nomMaison.'</td>');
  103. echo ('<td class="coul1">'.$surfMaison.'</td>');
  104. echo ('<td class="coul2">'.$codeMaison.'</td>');
  105. echo ('<td class="coul1">'.$prixMaison.'</td>');
  106. echo ('<td class="coul2">'.$nombChambMaison.'</td>');
  107.  
  108. echo '</tr>';
  109.  
  110.  
  111. }
  112.  
  113.  
  114. echo '</table>';
  115.  
  116.  
  117.  
  118. ?>
  119.  
  120. </body>
  121.  
  122. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement