Chrims Posted May 15, 2015 Share Posted May 15, 2015 Hello, how do i use mysql_real_escape_string in my AdminController? mysql_real_escape_string($string) returns nothing ;-/ public function makeStringSave($string) { $string = mysql_real_escape_string(utf8_decode($string)); return $string; } Is there a public PrestaShop Method? Thaaannks Link to comment Share on other sites More sharing options...
Chrims Posted May 15, 2015 Author Share Posted May 15, 2015 public function makeStringSave($string) { $string = pSQL(utf8_decode($string)); return $string; } That seems to work. Is pSQL the same as mysq_real_escape_string? Link to comment Share on other sites More sharing options...
DanielRomanMartinez Posted December 14, 2015 Share Posted December 14, 2015 (edited) Hello! You can use... $string=mysql_real_escape_string($string); Oh sorry, i didn't read. Seems a bit strange, because in my scripts i use it: require_once ('config/settings.inc.php'); // DB CONNECTION (CUSTOMIZE YOURDBHOSTNAME AND YOURDBPORT) $db = new PDO("mysql:host=10.6.64.25;port=3306;dbname="._DB_NAME_."", _DB_USER_, _DB_PASSWD_); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); And then $sql="Sentence SQL"; $res = $db->prepare($sql); $res->execute(); $row = $res->fetch(); What version are you using? I am using 1.6 Edited December 14, 2015 by DanielRomanMartinez (see edit history) Link to comment Share on other sites More sharing options...
webprog Posted August 21, 2017 Share Posted August 21, 2017 public function makeStringSave($string) { $string = pSQL(utf8_decode($string)); return $string; } That seems to work. Is pSQL the same as mysq_real_escape_string? Yes. pSQL is the same as mysq_real_escape_string Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now