No, you have not understood something fundamental.
htmlentities is an escaping mechanism for when the next target environment is a html stream, for a webpage, it escapes potentially dangerous characters which could lead to XSS attack.
mysql_real_escape_string is an escape mechanism for when the next target environment is mysql, it escapes potentially dangerous characters that could lead to an SQL injection style attack.
I have heard of some saying they use both, so that their data is always ready to be displayed on a webpage, but this would clearly depend upon all their data being html escaped, from when they originally put it in there.
This is not the common practice though AFAICT.
If you HAD put html escaped data in your table then your query would match, as far as I can see.