<?php

$User_ID=$_SESSION['UserId'];
$query = mysql_query("SELECT * FROM Users WHERE UserId='$User_ID'");
$row = mysql_fetch_array($query);
$filename=$row['PicUrl'];
if(isset($_SESSION["UserName"])){?>

        <img src="images/<?php echo $filename?>"  align="left"width="50px" height="50px"/> <?php echo $_SESSION["UserName"];
echo"<li><a href='logout.php'>Click here to Logout.</a></li>";
echo"<li><a href='user_update.php'>edit your account detail</li>";
}

?>

if pic url is empty then hide img scr

if(!empty($filename)){echo '<img src="images/'.$filename.'"  align="left"width="50px" height="50px"/>';}