Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Pour que toutes les erreurs et les warnings soient affichés
- error_reporting (E_ALL);
- ini_set ('display_errors' , 1);
- $connect=mysqli_connect('localhost','esteve3u','Nei1oob0ro','esteve3u_1') or die(mysqli_connect_error($connect));
- $okcharset=mysqli_set_charset($connect,'Utf8');
- if (isset($_GET['critere']))
- {
- $critere = $_GET['critere'];
- }
- else {
- $critere = "nomb";
- }
- $req="SELECT * FROM `immo_biens`,`immo_categories` WHERE `immo_biens`.categorieb = `immo_categories`.idc ORDER BY $critere";
- $resSQL=mysqli_query($connect,$req) or die(mysqli_error($connect));
- $okdeco=mysqli_close($connect);
- ?>
- <!doctype html>
- <html lang="fr">
- <head>
- <meta charset="utf-8">
- <title>Titre de la page</title>
- <meta name="author" content="Jean-Luc Husson" />
- <meta name="keywords" content="Exercice,html,PHP" />
- <meta name="description" content="formulaire de saisie des courses" />
- <link type="text/css" rel="stylesheet" href="devweb_styles.css" media="screen" />
- <!-- ========================================================= -->
- <!-- les liens vers les éventuelles feuilles de style externes -->
- <!-- ========================================================= -->
- <link rel="stylesheet" type="text/css" href="devweb_styles.css" />
- <!-- ========================================================= -->
- <!-- Eventuel style css interne -->
- <!-- ========================================================= -->
- <style type="text/css">
- /* Ici votre code CSS interne */
- body {
- }
- </style>
- </head>
- <body>
- <!-- ========================================================= -->
- <!-- Le contenu HTML de la page -->
- <!-- ========================================================= -->
- <?php
- // votre code PHP
- $nbMaisons=mysqli_num_rows($resSQL);
- echo '<div><h1>Version 1 / Nombre de bien: '.$nbMaisons.' </h1></div>';
- echo '<table>';
- echo '<tr>';
- echo ('<th>Photo</th>');
- echo ('<th><a href="index3.php?critere=categorieb">Categorie</a></th>');
- echo ('<th><a href="index3.php?critere=nomb">Nom</a></th>');
- echo ('<th><a href="index3.php?critere=surfaceb">Surface</a></th>');
- echo ('<th><a href="index3.php?critere=codeenergieb">Code energie</a></th>');
- echo ('<th><a href="index3.php?critere=prixb">Prix</a></th>');
- echo ('<th><a href="index3.php?critere=chambreb">Nombre chambre</a></th>');
- echo '</tr>';
- for($num=1;$num<=$nbMaisons;$num++){
- $tab=mysqli_fetch_array($resSQL);
- $nomMaison=$tab['nomb'];
- $prixMaison=$tab['prixb'];
- $mediaMaison=$tab['mediab'];
- $surfMaison=$tab['surfaceb'];
- $nombChambMaison=$tab['chambreb'];
- $codeMaison=$tab['codeenergieb'];
- $catMaison=$tab['nomc'];
- echo '<tr>';
- echo ('<td class="coul1"><img src="medias/'.$mediaMaison.'"/></td>');
- echo ('<td class="coul1")>'.$catMaison.'</td>');
- echo ('<td class="coul2">'.$nomMaison.'</td>');
- echo ('<td class="coul1">'.$surfMaison.'</td>');
- echo ('<td class="coul2">'.$codeMaison.'</td>');
- echo ('<td class="coul1">'.$prixMaison.'</td>');
- echo ('<td class="coul2">'.$nombChambMaison.'</td>');
- echo '</tr>';
- }
- echo '</table>';
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement