how to view messages with profile image .anyone help me
my profile view page
<?php
require("connect.php");
$username=$_SESSION['MM_Username'];
$query=mysql_query("SELECT *FROM members WHERE username='$username'");
if(mysql_num_rows($query)==0)
die("User not found!!!!");
else
{
$row=mysql_fetch_assoc($query);
$location=$row['avatar'];
echo "<img src='$location' width='100' height='100'>";
}
?>
My message page
<?php
require "database.php";
$userfinal=$_SESSION['MM_Username'];
// get the messages from the table.
$get_messages = mysql_query("SELECT message_id FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error());
$get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error());
$num_messages = mysql_num_rows($get_messages);
// display each message title, with a link to their content
for($count = 1; $count <= $num_messages; $count++)
{
$row = mysql_fetch_array($get_messages2);
//if the message is not read, show "(new)" after the title, else, just show the title.
if($row['message_read'] == 0)
{
echo'<hr color="#007FAA">';
echo '' . '' . $row['from_user'] . '<br>';
echo '' . '' . $row['message_contents'] . '</a><br><br>';
}else{
echo '<a href="read_message.php?messageid=' . $row['message_id'] . '">' . $row['message_title'] . '</a><br>';
}}
echo '<form name="backfrm" method="post" action="inbox.php">';
echo '<input type="submit" value="Back to Home">';
echo '</form>';
?>