my code for show avatar but image not display . how to correct the code

<?php

require 'connect.php';
$userg      = mysql_query("SELECT avatar FROM members")
    or die("Failed to fetch your details.");
                            
if (isset($_SESSION['MM_Username'])){
echo "Welcome ".$_SESSION['MM_Username'];
echo "<img src=";
echo $userg;
echo "></img>";

}
?>

$userg is result set not your field value...

So replace your line no 11 with

echo mysql_result($userg,0,"avatar");

please can you help me for define image size and width on this code

<?php
 
require 'connect.php';
$userg      = mysql_query("SELECT avatar FROM members")
    or die("Failed to fetch your details.");
 
if (isset($_SESSION['MM_Username'])){
echo "Welcome ".$_SESSION['MM_Username'];
echo "<img src=";
echo mysql_result($userg,0,"avatar" );
echo "></img>";
 
}
?>

my code for show avatar but image not display . how to correct the code

<?php

require 'connect.php';
$userg      = mysql_query("SELECT avatar FROM members")
    or die("Failed to fetch your details.");
                            
if (isset($_SESSION['MM_Username'])){
echo "Welcome ".$_SESSION['MM_Username'];
echo "<img src=";
echo $userg;
echo "></img>";

}
?>
<?php
     
		require 'connect.php';
		$userg = mysql_query("SELECT avatar FROM members") or die("Failed to fetch your details.");
		 
		if (isset($_SESSION['MM_Username']))
		{
			echo "Welcome ".$_SESSION['MM_Username'];
			echo "<img src=".mysql_result($userg,0,"avatar" )." width=200 height=200>";
     	}
    ?>
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.