0

How can security with PDO or what is the equivalent PDO this secure function?

function secure($string){
  return(mysql_real_escape_string(htmlspecialchars(strip_tags($string))));
}
Martin G
  • 17,357
  • 9
  • 82
  • 98

1 Answers1

0

Man PHP: you have to use the function PDO::quote()

http://php.net/manual/en/pdo.quote.php

Marchah
  • 160
  • 14
  • It should be a very rare circumstance that you're using `PDO::quote()` instead of a prepared statement. Important to note though, that this is _not_ a direct equivalent function to `mysql_real_escape_string()`, because `PDO::quote()` both escapes internally and places outer quotes on the string: From the linked docs "_PDO::quote() places quotes around the input string (if required) and escapes special characters_" – Michael Berkowski Apr 08 '15 at 20:26