le 01/03/2011 à 21:46
xmllama
Bonjour, ce code me parait pourtant juste mais cela me met une erreur au niveau de la requete sql donc je suis un peux bloqué .
Voici le code de la page en question :
Merci d'avance :) !
Voici le code de la page en question :
<?php
session_start();
if (!isset($_SESSION['login'])) {
header ('Location: connect.php');
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Rip Twinks</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="design.css" />
</head>
<body>
<?php include('includes/header.php'); ?>
<?php include('includes/menu.php'); ?>
<div id="corps">
Bienvenue <?php echo stripslashes(htmlentities(trim($_SESSION['login']))); ?> !<br /><br />
<?php
$base = mysql_connect ('localhost', 'root', '');
mysql_select_db ('rip twink', $base);
$sql = 'SELECT titre, date, membre.login as expediteur, messages.id as id_message FROM messages, membre WHERE id_destinataire="'.$_SESSION['id'].'" AND id_expediteur=membre.id ORDER BY date DESC';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$nb = mysql_num_rows($req);
if ($nb == 0) {
echo 'Vous n\'avez aucun message.';
}
else {
while ($data = mysql_fetch_array($req)) {
echo $data['date'] , ' - <a href="lire.php?id_message=' , $data['id_message'] , '">' , stripslashes(htmlentities(trim($data['titre']))) , '</a> [ Message de ' , stripslashes(htmlentities(trim($data['expediteur']))) , ' ]<br />';
}
}
mysql_free_result($req);
?>
<br /><a href="envoyer.php">Envoyer un message</a>
<br /><br /><a href="leave.php">Déconnexion</a>
</div>
<?php include('includes/footer.php'); ?>
</body>
</html>
Merci d'avance :) !