bad01aa4
kevin
modification dans...
|
1
|
<?php
|
db8bf362
kevin
modif sur news.php
|
2
3
|
require_once("creds.php");
$link = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD)
|
bad01aa4
kevin
modification dans...
|
4
5
6
|
or die("Impossible de se connecter : " . mysql_error());
echo 'Connexion réussie';
|
db8bf362
kevin
modif sur news.php
|
7
8
9
10
11
12
|
if(!mysql_select_db('crep', $link)){
echo 'Selection de la base de données impossible';
exit;
}
$requete = "select title content user.name as userName from news, user where news.fk_author==user.pk;";
|
bad01aa4
kevin
modification dans...
|
13
14
15
16
17
18
19
20
21
22
|
$resultat = mysql_query($requete);
//Pour debugger
if (!$resultat) {
$message = 'Requête invalide : ' . mysql_error() . "\n";
$message .= 'Requête complète : ' . $query;
die($message);
}
while ($row = mysql_fetch_assoc($resultat)) {
|
db8bf362
kevin
modif sur news.php
|
23
24
25
26
27
28
29
30
31
32
|
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'.$row['title'].'</h3>';
echo '</div>';
echo '<div class="panel-body">';
echo '<p>'.$row['content'].'</p>';
echo '</div>';
echo '<div class="panel-footer">';
echo '<p>'.$row['userName'].'</p>';
echo '</div></div>';
|
bad01aa4
kevin
modification dans...
|
33
34
35
36
37
38
|
}
//On libere l'espace de resultat.
mysql_free_result($result);
mysql_close($link);
?>
|
db8bf362
kevin
modif sur news.php
|
|
|