MySQL Password Writes but Doesn't Read!@#%^
| From: | Matthew Tedder | Date: | Thu, 03 Jan 2002 07:42:45 +0000 |
| Subject: | MySQL Password Writes but Doesn't Read!@#%^ | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15324@lists.php.net to get a copy of this message | ||
Can someone please explain this to me?! It's a real puzzle..
Using the "password('abc')" command in a MySQL insert statement works for me
but using it again in a select statement does not. Well--it does in one
MySQL database I have but doesn't in another one. I've done exactly the same
thing in each...
This one works (the next one does not):
=================================================
mysql> use medburg
Database changed
mysql> explain Users;
+----------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+-------+
| username | char(16) | | PRI | | |
| password | char(16) | YES | | NULL | |
+----------+----------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> insert into Users (username,password) values ('joe',password('joe1'));
Query OK, 1 row affected (0.04 sec)
mysql> select * from Users where password = password('joe1');
+----------+------------------+
| username | password |
+----------+------------------+
| joe | 2ca5307d5156d8ce |
+----------+------------------+
1 row in set (0.00 sec)
mysql>
This example does NOT appear to Work:
=================================================
mysql> use OpenSIG
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> explain Users;
+-------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+-------+
| usrlogin | char(15) | | PRI | | |
| usrpassword | char(15) | | | | |
| usrsurname | char(15) | YES | | NULL | |
| usrforname | char(15) | YES | | NULL | |
| usremail | char(64) | YES | | NULL | |
+-------------+----------+------+-----+---------+-------+
5 rows in set (0.00 sec)
mysql> insert into Users (usrlogin,usrpassword) values
('joe',password('joe1'));Query OK, 1 row affected (0.00 sec)
mysql> select * from Users where usrpassword = password('joe1');
Empty set (0.00 sec)
mysql>
So what on earth went wrong?? What was the difference besides field names?
I am totally lost here... Help...
--Matthew