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:[EMAIL PROTECTED]] 
:: Sent: Sunday, September 22, 2002 7:23 AM
:: To: [EMAIL PROTECTED]
:: 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
:: 
:: 
:: 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to