Also note that it's not always correct to simply apply [man]mysql_real_escape_string/man to everything.
For example, if you assume that a given piece of data like $GET['id'] is going to be numeric, and you use it in your query as if it were numeric, e.g.:
$sql = "SELECT * FROM foo WHERE id=$_GET[id]";
(that is, omitting the single quotes), then [man]mysql_real_escape_string/man isn't going to prevent SQL injections. Instead, you should do something like cast $_GET['id'] to integer.
The easiest solution (IMHO) is to move to a more updated library (one that's not deprecated) and use prepared statements.