Commit 9c0c9058bbb019c02c674d82d335f75cb3cfaf0d

Authored by Erwan Nanrocki
2 parents 3cf23dc9 fa68e797

Merge branch 'master' of ssh://servclubinfo.insecure.deule.net/crep

Showing 2 changed files with 20 additions and 5 deletions   Show diff stats
@@ -3,3 +3,4 @@ define("__MYSQL_USERNAME__", "crep"); @@ -3,3 +3,4 @@ define("__MYSQL_USERNAME__", "crep");
3 define("__MYSQL_PASSWORD__", "lescrepcestcool"); 3 define("__MYSQL_PASSWORD__", "lescrepcestcool");
4 define("__MYSQL_HOSTNAME__", "cambraisis.escaut.net"); 4 define("__MYSQL_HOSTNAME__", "cambraisis.escaut.net");
5 define("__MYSQL_DATABASE__", "crep"); 5 define("__MYSQL_DATABASE__", "crep");
  6 +?>
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 +