Posted by Gustavo Narea on 11/26/05 19:47
Hi.
Yaswanth Narvaneni wrote:
> Hi!
>
> Is there a function (or a code snippet) in PHP for mysql password() function?
>
> I 'dont' want to use something like select * from table where
> table.passwd=password($passwd);
>
> Is there any other alternate way to do it?
Try this:
<?php
$mypassword="this is my password!!!";
$query=mysql_query("SELECT PASSWORD('$mypassword')");
list($mysql_pass)=mysql_fetch_array($query);
mysql_free_result($query);unset($query);
printf( "My password is "%s" and Its hash value ".
"is "%s" computed by the MySQL PASSWORD() function",
$mypassword, $mysql_pass);
?>
You don't need a MySQL connection.
Happy weekend.
--
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.
Navigation:
[Reply to this message]
|