The private messages inbox display nothing.Can't find the error.Can anyone help??????????
<?php
session_start();
require("configure.php");
if (isset($_POST['view'])) {
$query = mysql_query("SELECT * FROM messages WHERE to_user = '$to_user' AND deleted = 'no'")or die(mysql_error());
while($row2 = mysql_fetch_array($query))
{
echo "<table border=1>";
echo "<tr><td>";
echo "Message ID#: ";
echo $row2['id'];
echo "</td></tr>";
echo "<tr><td>";
echo "To: ";
echo $row2['to_user'];
echo "</td></tr>";
echo "<tr><td>";
echo "From: ";
echo $row2['from_user'];
echo " ";
echo "</td></tr>";
echo "<tr><td>";
echo "Message: ";
echo $row2['message'];
echo "</td></tr>";
echo "</br>";
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td colspan=2></td></tr>
<tr><td></td><td>
<input type="hidden" name="id" maxlength="32" value = "<?php echo $row2['id']; ?>">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="delete" value="Delete PM # <?php echo $row2['id']; ?>">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="view" value="View PM # <?php echo $row2['id']; ?>">
</td></tr>
</table>
</form>
<?php
}
if (isset($_POST['delete'])) {
$id = $_POST['id'];
$to_user = $_SESSION['to_user'];
$sql = mysql_query("UPDATE messages SET deleted = 'yes' WHERE id = '$id' AND to_user = '$to_user'")or die(mysql_error());
echo "Your message has been succesfully deleted.";
}
$sql = mysql_query("SELECT * FROM messages WHERE to_user = '$_SESSION[$to_user]'")or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$to_user = $_SESSION['to_user'];
echo "<table border=1>";
echo "<tr><td>";
echo "Message ID#: ";
echo $row['id'];
echo "</td></tr>";
echo "<tr><td>";
echo "To: ";
echo $row['to_user'];
echo "</td></tr>";
echo "<tr><td>";
echo "From: ";
echo $row['from_user'];
echo "</td></tr>";
echo "<tr><td>";
echo "Message: ";
echo $row['message'];
echo "</td></tr>";
echo "</br>";
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td colspan=2></td></tr>
<tr><td></td><td>
<input type="hidden" name="id" maxlength="32" value = "<?php echo $row['id']; ?>">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="delete" value="Delete PM # <?php echo $row['id']; ?>">
</td></tr>
</table>
</form>
<?
echo "</table>";}}
?>
vindyauwu 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.