RE: [PHP] mysql password function
| From: | John Holmes | Date: | Mon, 23 Sep 2002 01:49:08 +0000 |
| Subject: | RE: [PHP] mysql password function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117222@lists.php.net to get a copy of this message | ||
Use this:
$result = mysql_query("SELECT PASSWORD(" . $_POST['password'] . ")");
$password = mysql_result($result,0);
or just use mysql_fetch_row() or AS in your query so you don't have to
recreate that complex column name.
---John Holmes...
> -----Original Message-----
> From: Murat Ö. [mailto:murat_inf@yahoo.com]
> Sent: Sunday, September 22, 2002 9:33 AM
> To: php-general@lists.php.net
> Subject: [PHP] mysql password function
>
> hi,
> i want to encode a string that users enter with mysql password
function.
> but
> sometimes this code works sometimes don't. mysql warns me:
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result
> resource in ........
>
> the code is:
>
> $result=mysql_query("select password(".$_POST['password'].")");
> while ($p = mysql_fetch_array($result, MYSQL_ASSOC)):
> $pswrd=$p['password('.$_POST['password'].')'];
> endwhile;
>
> thanks...
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php