Updating MySQL database with MD5 value
===

Having searched thoroughly through my code, the only reason that I could determine for this error is that the technique I am using for converting the string to MD5 is invalid. However I cannot find another way to do so.

        <?php
        	$username=$_POST['username'];
        	$password=$_POST['password'];
        	$repassword=$_POST['repassword'];
        	if($password=$repassword){
        	$con=mysql_connect("localhost","root","");	
        	if($con==true){
        		mysql_select_db("movedb",$con);
        		//$newpassword = mysql_real_escape_string(md5($_POST['password']));
        		$query = "UPDATE user SET password=MD5('$password') WHERE username='$username'";
        		// $query = "UPDATE user SET password='$newpassword' WHERE username='$username'";
        		$result=mysql_query($query,$con);
        		if($result==true){	
        				 echo "Successfully saved your message";
        		}else{
        			echo mysql_error();
        		}	
        		mysql_close($con);
        	}else{
        		echo "Cannot connect to the database";
        	}
        	}else{
        		echo "Passwords do not match!";
        	}
    ?>

Any ideas on how to update this MD value from PHP