I am having trouble with this code:

// Username
$username = $_POST['name'];

$email = $_POST['email'];

$con = mysql_connect('host','username','password') or die();
mysql_select_db('db', $con);
$var = md5($email);

$result = mysql_query("UPDATE `table` SET `imageEs`='$var' WHERE user_username='{$_SESSION['sessid']}'") 
or die(mysql_error());  

echo "Profile image updated. <a href='http://www.awsomechat.comuv.com/update_profile.php'>Go back.</a>";


I am trying to update a database, and this script seems to work, but it doesn't update or give any errors. I don't know what to do.

Recommended Answers

All 2 Replies

Your where clause is comparing the username to $_SESSION['sessid']

Make sure that session key matches the username. Also, make sure you have session_start(); at the top.

Amazing thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.