This is the easy way of doing it:-
$password = md5($password);
And then add it to the database, using your query of which you have posted.
So your coding should look like:-
$password = md5($password);
$sql = "UPDATE users SET password='$password' WHERE ID='$id'";