When using aggregate functions in sql, it is good to name that expression using the AS keyword.
Try this: $result = mysql_query("select password(".$_POST['password'].") AS pword"); while ($p = mysql_fetch_array($result, MYSQL_ASSOC)){ $pswrd=$p['pword']; } Also, like David said, you should also have exception handlers (need not be advanced). If you're like me and hate having to type too much, chuck your db stuff in a function. A very simple one would be doing this (this is not tested, by the way): function query($sql){ return @mysql_query($sql) or die("Error: ". mysql_error()); } Then to call it, simply $sql = "select password(".$_POST['password'].") AS pword"; $result = query($sql); Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php