Apr 14, 2020 05:37 AM
(This post was last modified: Apr 14, 2020 05:40 AM by rebug.)
I would like your opinion on this method to avoid any sql injection :
My request to database is always like this:
My function mssql escape string :
Thx
My request to database is always like this:
PHP Code
<?php
$request = odbc_exec($mssql, 'SELECT COUNT(*) as count FROM [%NAME%] WHERE %value%=\''.mssql_escape_string($_GET['%GETPARAM%']).'\'');
My function mssql escape string :
PHP Code
<?php
function mssql_escape_string($string) {
$replaced_string = str_replace("'", "''", $string);
return $replaced_string;
}
Thx

