Hi, I have been trying to integrate gravatar to my login system but it doesn't seem to work.
Here is the code:
<?php include("include/session.php"); $connectmysql = mysql_connect("localhost", "********_login", "*******"); mysql_select_db("********_login", $connectmysql); ?> <html> <?php $email = mysql_query("SELECT email FROM blog_users WHERE user = '$session->username', $connectmysql"); $default = "mm"; //This returns another image if there is no avatar with the email given $size = 40; $grav_url = "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?d=" . urlencode( $default ) . "&s=" . $size; ?> <br/><img src="<?php echo $grav_url; ?>" alt="" /> </html>
When I echo $email it returns nothing. So, that might be the problem. Please could someone help.
$session->username //This returns the username of the logged in user