Use parametrized queries with ADODB or PDO. These libraries know the best escape function to use based on the database it is connected to. They allow you to switch between mysql and ms-sql without introducing vulnerabilities.
SQL Injection for MySQL and MS-SQL are radically different.
SQL Injection for MS-SQL is much more serious. For one you can stack queries:
select * from `table` where id='1' ; drop table `table`;-- '
Escaping is totally different, addslashses() does not stop sql injection under MS-SQL. It uses a double quote system so this is an escaped query:
select * from table where test='trying to inject '' didn''t work!'
A hacker can also access cmd.exe using xp_cmdshell
from a sql query. Make sure this privilege has been removed!
Under MySQL you can't stack, so its common to use union select (only works when injection into a select, otherwise you can use a sub-select, but you can't stack a drop/update/delete/insert on top of a select):
select somthing from table where 1 union select password from mysql.user
Escaping is done with back slashes, addslashes() works most of the time, but mysql_real_escape_string() is a lot better.
select * from table where test='trying to inject \' didn\'t work!'
Also you want to disable file_priv otherwise a hacker might be able to drop a backdoor:
select test from table where name='jon' union select "<?php eval($_GET[e])?>" into outfile "/var/www/backdoor.php"-- '