As part of a login I'm using a key that is held against the user within the 'users' table. I having trouble obtaining the key from the database and then using it to decode the password. I get the key from the users table put it does not what to assign the value to the variable $data, Taking that the value returned from the query would be an array I try reference the $data variable as $data[0] but made no difference.
public function checklogin($Email,$Pass)
{
$data = $this->db->query(select Key from users where User = $Email);
$Password = $this->encrypt->decode($Pass,$data);
$this->db->select('User','Pwd','Level');
$this->db->from('users');
$this->db->where('User', $Email);
$this->db->where('Pwd', $Password);
$this->db->where('Active','Y');
$query = $this->db->get();
}
Var dump returns: object(CI_DB_mysqli_result)#25 (8) { ["conn_id"]=> object(mysqli)#15 (19) { ["affected_rows"]=> int(1) ["client_info"]=> string(79) "mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $" ["client_version"]=> int(50011) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(1) ["host_info"]=> string(20) "localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(21) "5.5.5-10.1.25-MariaDB" ["server_version"]=> int(50505) ["stat"]=> string(134) "Uptime: 25131 Threads: 2 Questions: 380 Slow queries: 0 Opens: 28 Flush tables: 1 Open tables: 21 Queries per second avg: 0.015" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(89) ["warning_count"]=> int(0) } ["result_id"]=> object(mysqli_result)#24 (5) { ["current_field"]=> int(0) ["field_count"]=> int(1) ["lengths"]=> NULL ["num_rows"]=> int(1) ["type"]=> int(0) } ["result_array"]=> array(0) { } ["result_object"]=> array(0) { } ["custom_result_object"]=> array(0) { } ["current_row"]=> int(0) ["num_rows"]=> NULL ["row_data"]=> NULL }