List:General Discussion« Previous MessageNext Message »
From:Chris Knipe Date:March 20 2004 7:03am
Subject:*very* strange...
View as plain text  
Lo everyone,

I'm *baffled* completely.... I've never seen something like this before.....
:((((  I tried this exact query from PHP, Perl, as well as the MySQL
thingy... They ALL give the same result - it must therefore be my table....


mysql> SELECT VERSION();
+------------+
| VERSION()  |
+------------+
| 4.0.14-log |
+------------+
1 row in set (0.00 sec)

mysql> SHOW TABLES LIKE 'Accounts';
+--------------------------------+
| Tables_in_SAV001 (DSLAccounts) |
+--------------------------------+
| Accounts                       |
+--------------------------------+
1 row in set (0.00 sec)

mysql> SHOW TABLE STATUS LIKE 'Accounts';
+-------------+--------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+---------------
------+---------------------+------------+----------------+---------------+
| Name        | Type   | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment | Create_time
| Update_time         | Check_time | Create_options | Comment       |
+-------------+--------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+---------------
------+---------------------+------------+----------------+---------------+
| Accounts    | MyISAM | Dynamic    |   42 |             44 |        1888 |
4294967295 |         7168 |         0 |             49 | 2004-03-20 08:53:01
| 2004-03-20 08:54:42 | NULL       |                | Accounts |
+-------------+--------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+---------------
------+---------------------+------------+----------------+---------------+
1 row in set (0.00 sec)

mysql> SHOW KEYS FROM `Accounts`;
+-------------+------------+----------+--------------+-------------+--------
---+-------------+----------+--------+------+------------+---------+
| Table       | Non_unique | Key_name | Seq_in_index | Column_name |
Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+----------+--------------+-------------+--------
---+-------------+----------+--------+------+------------+---------+
| Accounts    |          0 | PRIMARY  |            1 | EntryID     | A
|          42 |     NULL | NULL   |      | BTREE      |         |
| Accounts    |          0 | Username |            1 | Username    | A
|          42 |     NULL | NULL   |      | BTREE      |         |
| Accounts    |          1 | isActive |            1 | isActive    | A
|        NULL |     NULL | NULL   |      | BTREE      |         |
| Accounts    |          1 | isCapped |            1 | isCapped    | A
|        NULL |     NULL | NULL   |      | BTREE      |         |
+-------------+------------+----------+--------------+-------------+--------
---+-------------+----------+--------+------+------------+---------+
4 rows in set (0.00 sec)

mysql> SHOW FULL FIELDS FROM `Accounts`;
+----------+----------------------+------+-----+---------+----------------+-
--------------------------------+
| Field    | Type                 | Null | Key | Default | Extra          |
Privileges                      |
+----------+----------------------+------+-----+---------+----------------+-
--------------------------------+
| EntryID  | smallint(6) unsigned |      | PRI | NULL    | auto_increment |
select,insert,update,references |
| Username | varchar(150)         |      | UNI |         |                |
select,insert,update,references |
| Password | varchar(150)         |      |     |         |                |
select,insert,update,references |
| isActive | enum('y','n')        |      | MUL | y       |                |
select,insert,update,references |
| isCapped | enum('y','n')        |      | MUL | n       |                |
select,insert,update,references |
+----------+----------------------+------+-----+---------+----------------+-
--------------------------------+
5 rows in set (0.00 sec)

mysql> SHOW FIELDS FROM `Accounts` FROM `SAV001`;
+----------+----------------------+------+-----+---------+----------------+
| Field    | Type                 | Null | Key | Default | Extra          |
+----------+----------------------+------+-----+---------+----------------+
| EntryID  | smallint(6) unsigned |      | PRI | NULL    | auto_increment |
| Username | varchar(150)         |      | UNI |         |                |
| Password | varchar(150)         |      |     |         |                |
| isActive | enum('y','n')        |      | MUL | y       |                |
| isCapped | enum('y','n')        |      | MUL | n       |                |
+----------+----------------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

mysql> INSERT INTO Accounts (Username, Password) VALUES
(Username='username@realmname', Password='password');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM Accounts WHERE Username='username@realmname';
Empty set (0.00 sec)

mysql>

HOWEVER....

mysql> SELECT * FROM Accounts WHERE Username='0';
+---------+----------+----------+----------+----------+
| EntryID | Username | Password | isActive | isCapped |
+---------+----------+----------+----------+----------+
|      48 | 0        | 0        | y        | n        |
+---------+----------+----------+----------+----------+
1 row in set (0.00 sec)

There's my entry.  It's the row that was inserted, because I can see from
the EntryID (Auto Increment).

Now, WTF is wrong here...   Nevermind what the value is I send to Username /
Password, Mysql *ALWAYS* replaces the data specified with a 0.  Needless to
say, due to the UNIQUE keys, I dont ever get the data into my table.... :(((







Thread
*very* strange...Chris Knipe20 Mar
  • Re: *very* strange...Chris Knipe20 Mar
    • Re: *very* strange...mos22 Mar
  • Re: *very* strange...Andy Bakun20 Mar
  • Re: *very* strange...Nitin Mehta20 Mar