Originally Posted by docock
I'm not sure if they do the same.
No they don't.
mysql_real_escape_string() will put a \ before all characters that could be dangerous / end & restart a SQL statement.
Both can be used for security however they serve entirely different purposes.
You would use mysql_real_escape_string() to protect your sql statement so that an attacker can't inject their own commands into your sql statement.