I am having trouble with this code:

<?php
// Username
$username = $_POST['name'];

$email = $_POST['email'];

// MYSQL
$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

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.

Jump to Post

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.