CodeIgniter Forums
Database in 1.6.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Database in 1.6.0 (/thread-5720.html)



Database in 1.6.0 - El Forum - 02-01-2008

[eluser]BlueCamel[/eluser]
I'm reading the 1.6.0 docs for escaping database values:
http://ellislab.com/codeigniter/user-guide/database/queries.html

For $this->db->escape_str($data) and $this->db->escape($data), the docs say that it adds single quotes around the data so you don't have to.

For mysql on 1.6.0 with php 5.2.3, this doesn't appear to be the case. Is this a doc bug or a code bug?


Database in 1.6.0 - El Forum - 02-01-2008

[eluser]BlueCamel[/eluser]
Actually, more testing shows that $this-db->escape_str($data) is what fails. The $this->db->escape($data) always returns the data as a quoted value.


Database in 1.6.0 - El Forum - 02-01-2008

[eluser]Derek Jones[/eluser]
Double check the docs, there, BlueCamel. escape() will escape and quote your data, escape_str() will merely escape it.


Database in 1.6.0 - El Forum - 02-01-2008

[eluser]BlueCamel[/eluser]
True enough. To much focus on my own code and not enough on how to use CI. Thanks.