Visualiser un message en php

Fermé
lili1192 - 9 mai 2014 à 01:29
salut tout le monde , pour mon site web j'ai crée un espace pour le membre ( messagerie ) et ça marche bien , les messages s'affichent correctement dans un tableau avec l'heure et la date.. maintenant mon problème et et quand je visualiser un message je veux faire un idée dés que je clique sur le titre du message automatiquement tout le message s'affiche dans une autre page , mes ça marche pas chaque fois il affiche le meme message !!!!! la création dans ma table est en php si pour ça si elle était en html c'est simple voila mon code source , si vous pouvez aidez moi svp
<?php require_once('Connections/con2.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
if ((isset($_GET['id_parent'])) && ($_GET['id_parent'] != "") && (isset($_GET['supp']))) {
$deleteSQL = sprintf("DELETE FROM messag_parent WHERE id_parent=%s",
GetSQLValueString($_GET['id_parent'], "int"));

mysql_select_db($database_con2, $con2);
$Result1 = mysql_query($deleteSQL, $con2) or die(mysql_error());

$deleteGoTo = "membre_parent.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
mysql_select_db($database_con2, $con2);
$query_Recordset1 = "SELECT * FROM messag_parent";
$Recordset1 = mysql_query($query_Recordset1, $con2) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_con2, $con2);
$query_Recordset2 = "SELECT * FROM membre_p";
$Recordset2 = mysql_query($query_Recordset2, $con2) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
session_start();
// on vérifie toujours qu'il s'agit d'un membre qui est connecté
if (!isset($_SESSION['logn'])) {
// si ce n'est pas le cas, on le redirige vers l'accueil
header ('Location: index_parent.php');
exit();
}
?>
<html>
<head>
<style type="text/css">
.Style42{
color:#009966;
margin-top:35px;
}
.home_right {
width:300px;
float:left;
margin-top:20px;
}
body{
background:#FFFFFF;
}
.t{
margin-top:5px;
background:#00CCCC;

}
.bare{
margin-top:1px;
width:1413px;
background:#400040;
}
.bien{
color:#660066;
margin-top:40px;
margin-left:80px;
font-size:26px;
font-family:Forte;
text-decoration:blink;
}
.t2{
margin-top:70px;
background:white;
border:#00CCCC;
}
.p{clear: left;
height: 60px;
width:300px;
margin-right: 10px;
padding:5px;
float: left;
border-width: 2px;
border-color:#660099;
border-style:solid;
background-color:#663399;
border-radius: 0em 0em ;
margin-top:100px;
}
.Style45 {color: #FFFFFF}
.Style46 {color: #590059}
.Style49 {
color: #0033CC;
font-style: italic;
font-weight: bold;
font-size: 24px;
}
.Style51 {color: #6600CC; margin-top: 40px; margin-left: 80px; font-size: 26px; font-family: Forte; text-decoration: blink; }
</style>
<title>Espace membre</title>
</head>
<body>
<div class="bare">
<table width="1414" border="1" bgcolor="#590059">
<tr>
<td width="1404" height="43"><span class="Style46">
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzzzza
aaaaaaaaa
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="161" height="28">
<param name="movie" value="text59.swf">
<param name="quality" value="high">
<param name="bgcolor" value="#530053">
<embed src="text59.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="161" height="28" bgcolor="#530053"></embed>
</object>
aaaaaaa</span></td>
</tr>
</table>
</div>
<span class="Style49">Jardin Horizon </span>
<div class="Style51">Bien venus dans votre espace <?php echo stripslashes(htmlentities(trim($_SESSION['logn']))); ?> <img src="Pictures/emoticone-SOURIRE1.jpg" width="55" height="57"></div>

<div class="home_right">
<div id="pages-2" class="dtbaker_widget widget_pages"><div class="dtbaker_widget_bottom">
<p class="widgettitle">
<span class="Style45">aaaa</span></p>
<table width="200" height="324" border="0" bgcolor="#00CCCC">
<tr>
<td height="193"><p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="62" height="27">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="movie" value="text67.swf">
<param name="quality" value="high">
<embed src="text67.swf" width="62" height="27" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#00CCCC" ></embed>
</object>
</p>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="178" height="30">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="movie" value="text68.swf">
<param name="quality" value="high">
<embed src="text68.swf" width="178" height="30" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#00CCCC" ></embed>
</object>
</p>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="170" height="30">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="BGCOLOR" value="#00CCCC">
<param name="movie" value="text69.swf">
<param name="quality" value="high">
<embed src="text69.swf" width="170" height="30" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#00CCCC" ></embed>
</object>
</p></td>
</tr>
</table>
<p class="widgettitle"> </p>
<p class="widgettitle"><strong><span class="Style45">aaa</span></strong></p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle"> </p>
<p class="widgettitle">  </p>
</div>
</div></div>
</div>
<div class="Style42">
<table class="t2" width="910" height="319" border="4" bgcolor="#FFFFFF" >
<tr>
<td width="898" height="315"><?php
// on prépare une requete SQL cherchant tous les titres, les dates ainsi que l'auteur des messages pour le membre connecté
$sql = 'SELECT titre_parent, date_parent, mes_parent,admin.user_a as expe,messag_parent.id_parent as id_message FROM messag_parent,admin WHERE id_dest="'.$_SESSION['id'].'" AND id_expe=admin.id_admin ORDER BY date_parent DESC';
// lancement de la requete SQL
$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{
// si on a des messages, on affiche la date, un lien vers la page lire.php ainsi que le titre et l'auteur du message
while ($data = mysql_fetch_array($req)){
echo"<font color='red'><h2></h2></font>";
echo"<table align=center , border=4, height=50 > ";
echo"<tr>
<th><font color='#590059'><h3>N</h3></th>
<th><font color='#590059'><h3>Date</h3></th>
<th><font color='#590059'><h3>Titre</h3></th>
<th><font color='#590059'><h3>Message</h3></th>
<th><font color='#590059'> <h3> De</h3></th></tr>";
$sql = 'SELECT titre_parent, date_parent, mes_parent,admin.user_a as expe,messag_parent.id_parent as id_message FROM messag_parent,admin WHERE id_dest="'.$_SESSION['id'].'" AND id_expe=admin.id_admin ORDER BY date_parent DESC';
// lancement de la requete SQL
$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($row = mysql_fetch_row($req))
{
$id_parent =$row[4];
$date_parent =$row[1];
$titre_parent = $row[0];
$id_expe = $row[3];
$mes_parent = $row[2];
echo"
<tr>
<td><font color='#590059'><h3>$id_parent </h3></font></td>
<td><font color='#590059'><h3>$date_parent </h3></font></td>
<td><font color='#590059'><h3>$titre_parent </h3></font></td>
<td><font color='#590059'><h3>$mes_parent</h3></font></td>
<td><font color='#590059'><h3>$id_expe</h3></font></td>
<td><font color='#590059'><h3><a href=membre_parent.php','>visulaliser</a> </h3></font></td>
</tr>
";
}
echo"</table> ";
}
}
mysql_free_result($req);
mysql_close();
?></td>
</tr>
</table>
<p> </p>
<p> </p>

<p> </p>
<p><span class="Style45">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span></p>
<p><br />
<br />
</p>
</div>
<form action="detailpri_ins.php" method="post" name="form1" id="form1">
<p> </p>
</form>

<p>  </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>