我知道了,原来我是在php代码中执行,没得到正确结果,后来在DOS命令提示符下使用就可以了,但现在又发现新问题了.当我按那页面的代码测试后.
SELECT * FROM shirt;
+----+---------+--------+-------+
| id | style   | color  | owner |
+----+---------+--------+-------+
|  1 | polo    | blue   |     1 |
|  2 | dress   | white  |     1 |
|  3 | t-shirt | blue   |     1 |
|  4 | dress   | orange |     2 |
|  5 | polo    | red    |     2 |
|  6 | dress   | blue   |     2 |
|  7 | t-shirt | white  |     2 |
+----+---------+--------+-------+,这结果是正确的,然后我用下面的php插入一条记录mysql_query("INSERT INTO shirt VALUES(NULL,'dress','orange',LAST_INSERT_ID())");,在这php执行后,我又转到DOS命令提示符下,在用INSERT INTO shirt VALUES(NULL,'dress','orange',LAST_INSERT_ID());语句执行了一下.结果现在SELECT * FROM shirt;
+----+---------+--------+-------+
| id | style   | color  | owner |
+----+---------+--------+-------+
|  1 | polo    | blue   |     1 |
|  2 | dress   | white  |     1 |
|  3 | t-shirt | blue   |     1 |
|  4 | dress   | orange |     2 |
|  5 | polo    | red    |     2 |
|  6 | dress   | blue   |     2 |
|  7 | t-shirt | white  |     2 |
|  8 | dress   | orange |     0 |
|  9 | dress   | orange |     4 |
+----+---------+--------+-------+这owner的指怎么会为0或4呢.在person表的id中没有这两个值呀?