how to set avatar to my profile page .anyone help me for set my avatar image path in my profile page.

<?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>";
     	}
    ?>

Cant you just echo out the path, where your image is kept? Instead of taking it from the DB?

What is the problem with the above code?

What is the problem with the above code?

i want to set avatar to my profile page i don't no how to set path.

Put this code in line no 5 and check the path is correct.

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

Where your images are storing ? Are they same root of that PHP file ? If not, put the absolute path or relative path like below:

echo "<img src=\"http://yoursite.com/images/avatar/".mysql_result($userg,0,"avatar" )." width=\"200\" height=\"200\">";

By the way, don't post many thread with the same case.

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.