1

Hi has anyone had experience with using AES_DECRYPT and codeigniters active record. I've tried using the following line:

$query = $this->db->select("AES_DECRYPT(testing,'$key') as testing");

but continue to get an sql syntax error. I've tried using a manual standard sql string which works but would prefer to stick with active record if I can.

4

1 回答 1

2

CodeIgniter is trying to escape that, and it has no idea how to. Add FALSE as the 2nd parameter to tell it not to escape it.

// We need to escape this value before the query
$key = $this->db->escape($key);
// Tell CodeIgniter not to escape this
$this->db->select("AES_DECRYPT(testing, $key) as testing", FALSE);
于 2013-01-07T17:28:33.093 回答