At 8:49 PM -0400 6/16/01, William Wong wrote:
>Hi there,
>
>For some reason, this query doesn't work:
>
>PHP4> mysql_query("select * from user where username='myname' and passwd =
>password('mypass')");

Define "doesn't work".  Fails to return rows?  PHP generates an error message?

>
>WHILE this one does work:
>
>PHP4> mysql_query("select * from user where username='myname' and
>password('mypass')");
>
>Notice the lack of "passwd = " in the second version.

password('mypass') is a legal expression.  It returns a non-empty string,
which probably evaluates to true.  The statement is therefore equivalent
to:

select * from user where username='myname'



>
>Anyone know why this is happening?
>
>Regards,
>- Will
>
>OS: FreeBSD 4.3R
>PHP: 4.05
>MySQL: 3.23.38
>
>mysql> describe user;
>+----------+-------------+------+-----+---------+-------+
>| Field    | Type        | Null | Key | Default | Extra |
>+----------+-------------+------+-----+---------+-------+
>| username | varchar(12) |      | PRI |         |       |
>| passwd   | varchar(12) |      |     |         |       |
>| email    | varchar(30) |      |     |         |       |
>+----------+-------------+------+-----+---------+-------+


-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to