Welcome Guest, Not a member yet? Register   Sign In
Database escape problem
#2

[eluser]Derek Jones[/eluser]
escape() already adds quotes for you intelligently based on the variable type. So you're ending up with double single quotes:

Code:
VALUES(’’dasd’’

Don't use quotes around your variables that you are escape()ing. Alternatively, use $this->db->escape_str() which just escapes the data and doesn't add quotes.

User Guide Reference

Or you can use Active Record's insert() method to handle it all for you:

Code:
$data['username'] = $this->input->post('username');
...

$this->db->insert('users', $data)


Messages In This Thread
Database escape problem - by El Forum - 07-12-2008, 11:20 AM
Database escape problem - by El Forum - 07-12-2008, 01:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB