Commit db8bf362d27b4f55870b04e318bae9619493f03d

Authored by kevin
1 parent 3fb74cc5

modif sur news.php

Showing 1 changed file with 19 additions and 5 deletions   Show diff stats
1 -<div class="jumbotron">  
2 <?php 1 <?php
3 - $link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__) 2 + require_once("creds.php");
  3 + $link = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD)
4 or die("Impossible de se connecter : " . mysql_error()); 4 or die("Impossible de se connecter : " . mysql_error());
5 echo 'Connexion réussie'; 5 echo 'Connexion réussie';
6 6
7 - $requete=""; 7 + if(!mysql_select_db('crep', $link)){
  8 + echo 'Selection de la base de données impossible';
  9 + exit;
  10 + }
  11 +
  12 + $requete = "select title content user.name as userName from news, user where news.fk_author==user.pk;";
8 $resultat = mysql_query($requete); 13 $resultat = mysql_query($requete);
9 14
10 //Pour debugger 15 //Pour debugger
@@ -15,11 +20,20 @@ @@ -15,11 +20,20 @@
15 } 20 }
16 21
17 while ($row = mysql_fetch_assoc($resultat)) { 22 while ($row = mysql_fetch_assoc($resultat)) {
18 - //On execute les traitements lié a la requete. 23 + echo '<div class="panel panel-default">';
  24 + echo '<div class="panel-heading">';
  25 + echo '<h3 class="panel-title">'.$row['title'].'</h3>';
  26 + echo '</div>';
  27 + echo '<div class="panel-body">';
  28 + echo '<p>'.$row['content'].'</p>';
  29 + echo '</div>';
  30 + echo '<div class="panel-footer">';
  31 + echo '<p>'.$row['userName'].'</p>';
  32 + echo '</div></div>';
19 } 33 }
20 34
21 //On libere l'espace de resultat. 35 //On libere l'espace de resultat.
22 mysql_free_result($result); 36 mysql_free_result($result);
23 mysql_close($link); 37 mysql_close($link);
24 ?> 38 ?>
25 -</div> 39 +