You don't need to use htmlentities before storing data in the database. In fact, it makes things easier later if you don't. Only use htmlentities on strings as you echo them in HTML output (whether you fetched the string from a database or from some other source).
You don't need to apply stripslashes to data after you fetch it from the database. The database has not stored the extra escaping characters -- unless you applied double-escaping by mistake.
Here's the right sequence:
Get data from a form
$input = $_GET["input"];
Apply escaping once.
$quoted_input = "'" . mysql_real_escape_string($input) . "'";
Insert it into the database
$sql = "INSERT INTO MyTable (column1) VALUES ($quoted_input)";
$success = mysql_query($sql);
Later fetch it from the database
$sql = "SELECT column1 FROM MyTable";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$data = $row["column1"];
Apply htmlentities once as you output.
echo htmlentities($data);