Page 1 of 1
How get the result from mysql select
Posted: Wed Jan 08, 2003 1:16 am
by Robin_Hoo
Hi, All,
I'm a beginner of PHP. I wanna use the aes_encrypt or aes_decrypt from mysql. But I don't know how to get the result of select aes_encrypt("text","password") from mysql. Is there anyone know how to handle it. Thanks.
Posted: Wed Jan 08, 2003 2:30 am
by DaZZleD
for some odd reason(i think) i cannot use the aes_encrypt() or aes_decrypt() function in mysql console mode ... but if this works for you, then this should work too:
Code: Select all
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect");
mysql_select_db("your database") or die("Could not select database");
$query="select aes_encrypt('text', 'password');";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$encrypted_text = $row[0];
?>
Posted: Wed Jan 08, 2003 12:25 pm
by BDKR
Did you check here?
http://www.mysql.com/doc/en/Miscellaneo ... tions.html
Also note the versions of MySQL you need to use these functions.
Cheers,
BDKR
Posted: Wed Jan 08, 2003 7:22 pm
by Robin_Hoo
Thanks. DaZZleD and BDKR. That's very helpful advice.
