As Spudley said you should R&D more. Just to make it a few easier for you
You may use mysql(i)_ real escape functions but if you're using a framework works on top of PDO you don't have a mysql(i)_* connection and can't escape strings using them
i have seen this problem previously on yii or f3 or ...
Mostly the frameworks support the param safe injection.
\Framework::Query("SELECT .... WHERE column=:param", array(':param'=>$value));
But some times you may need to escape the string value manually. To do that with PDO you can acquire the pdo object and use the :
substr($pdo->quote($string, , \PDO::PARAM_STR), 1, -1)
The only note is that the ->quote() also puts the apostrophes around the result which they can get wiped using substr.
Edited to make the codes clear