CodeIgniter Forums
Problems escaping with db->escape and the active record - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problems escaping with db->escape and the active record (/showthread.php?tid=46798)



Problems escaping with db->escape and the active record - El Forum - 11-15-2011

[eluser]Unknown[/eluser]
Hi guys im havin a problem,m as you can see in the title.


$this->db->set('username', $this->db->escape($_POST['username']));
$this->db->set('name', $this->db->escape($_POST['name']));
$this->db->insert('users');

so the data is inserted in the database like this:

table users:
username | name
'user' | 'myname'

and when i retrieve the data and echo somewhere in the page, the result
comes with '

<b>Username: 'user'</b>
<b>Name: 'myname' </b>

How i can fix this thing.

And the other problem tham im haivng is saving values like: é,á,ñ.
this values are represented in the database like: 'o?o?',
or are truncated or deleted.


and usign mysql_real_escape_string, is not working either

Thanks for all your replies.