Jump to content

How to use "mysql_real_escape_string" in a Module


Recommended Posts

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

  • 6 months later...

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 by DanielRomanMartinez (see edit history)
Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...