RE: [PHP-DB] password function
| From: | Stephen Craton | Date: | Sun, 22 Sep 2002 16:25:16 +0000 |
| Subject: | RE: [PHP-DB] password function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117181@lists.php.net to get a copy of this message | ||
Not sure if this has been answered yet but since the new version of PHP,
I found that it doesn't like you entering the SQL statements in the
query tag directly. Here's what you should do.
$sql = "select password(".$_POST['password'].")"
$conn = **YOUR DATABASE CONNECTION**
$result = mysql_query($sql, $conn);
while ($p = mysql_fetch_array($result, MYSQL_ASSOC)):
$pswrd=$p['password('.$_POST['password'].')'];
endwhile;
Remember to replace **YOUR DATABASE CONNECTION** with, evidently, your
database connection. What I usually do is assign a function
(db_connect()) to connect to the database and select the database then
just put $conn = db_connect().
Hope that helps!
Thanks,
Stephen Craton
http://www.melchior.us
http://php.melchior.us
:: -----Original Message-----
:: From: Murat Ö. [mailto:murat_inf@yahoo.com]
:: Sent: Sunday, September 22, 2002 7:23 AM
:: To: php-db@lists.php.net
:: Subject: [PHP-DB] 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 Database Mailing List (http://www.php.net/)
:: To unsubscribe, visit: http://www.php.net/unsub.php
::
::
::