这是我的QUERY
SELECT client_id,client_name,client_db_ip,client_db_username,AES_ENCRYPT(client_db_pass, '1234') as client_db_pass,client_db_name FROM client_list WHERE client_id =:id
//请关注AES_ENCRYPT(client_db_pass,'1234')作为client_db_pass
现在,如果我直接使用phpmyadmin查询,我会在AES_ENCRYPT之后得到例如client_db_pass的结果:
501defc4013f3f21529c123f33c065ad
但问题是当我使用PDO获取数据时,
$Q = "SELECT client_id,client_name,client_db_ip,client_db_username,AES_ENCRYPT(client_db_pass, '1234') as client_db_pass,client_db_name FROM client_list WHERE client_id =:id";
$R = $this->pdo->prepare($Q);
$R->bindParam(':id', $id);
$R->execute();
$result = $R->fetch(PDO::FETCH_ASSOC);
如果我var_dump($ result)
我会得到这个结果:
array (size=6)
'client_id' => string '1' (length=1)
'client_name' => string 'tester' (length=4)
'client_db_ip' => string '127.0.0.2' (length=9)
'client_db_username' => string 'root' (length=4)
'client_db_pass' => string 'PïÄ??!Rœ?3Àe' (length=16)
'client_db_name' => string 'test_user' (length=9)
你能看到'client_db_pass'字符串的数组是
result 2 = PïÄ??!Rœ?3Àe
不
result 1 = 501defc4013f3f21529c123f33c065ad
如果使用pdo,我可能知道如何获得结果1“501defc4013f3f21529c123f33c065ad”吗?
谢谢