Welcome Guest, Not a member yet? Register   Sign In
Insert in DB without escaping
#1

[eluser]gryzzly[/eluser]
Hy,

What the best way to avoid input escaping when inserting datas in Db ?

I explain :
Suppose i want to insert configuration params into db (ex : key->tracker, value->the_google_analytics_script). The analytcs script is something like
Code:
<\script ....>a script with ' and " and & and diverse not conventionnals chars<\/script>
.

But, the active record class escape everything. We just get something we don't want in db:

Code:
&lgt;script&rgt;the script escaped&lgt;/script&rgt;

Doing so, if we need to make a call to the value dynamically, it will never work, since it's transformed into html chars and escaped.

What the best way to avoid this behavior ?

Manual query ?
$query="...";
$this->db->query($query);

Other ?

Thank's. And sorry if i'm not very clear :o)
#2

[eluser]jalalski[/eluser]
Use
Code:
$this->db->set();

and set the third parameter to false.




Theme © iAndrew 2016 - Forum software by © MyBB