[eluser]Adam_R[/eluser]
How can I use AES_ENCRYPT and CI2 db->insert?
My code looks like:
Code:
public function storeData($name){
$data = array('stamp' => mktime(0,0,0,date('n'),date('j'),date('Y')));
foreach($_POST as $field => $value) {
$data[$field] = $value;
}
return $this->db->insert($name, $data);
}
is this correct?
Code:
foreach($_POST as $field => $value) {
$data[$field] = AES_ENCRYPT($value,$this->config->item('encryption_key'));
}
or rather that:
Code:
foreach($_POST as $field => $value) {
$this->db->set($field, "AES_ENCRYPT('{$value}', $this->config->item('encryption_key'))", FALSE);
}
return $this->db->insert($name);
Thanks