我在一个表中有两个字段(标题,内容),我插入了一些值......:
+--------------------------------------+--------------------------+
| title | content |
+--------------------------------------+--------------------------+
| hello word | this is my first content |
+--------------------------------------+--------------------------+
| smoke Smoking is bad for your health | But i love it |
+--------------------------------------+--------------------------+
如果我添加一个名为ID的auto_increment字段,则之前输入的值取ID = 0:
+---+--------------------------------------+--------------------------+
|ID | title | content |
+---+--------------------------------------+--------------------------+
| 0 | hello word | this is my first content |
+---+--------------------------------------+--------------------------+
| 0 | smoke Smoking is bad for your health | But i love it |
+---+--------------------------------------+--------------------------+
我需要这个:
+---+--------------------------------------+--------------------------+
|ID | title | content |
+---+--------------------------------------+--------------------------+
| 1 | hello word | this is my first content |
+---+--------------------------------------+--------------------------+
| 2 | smoke Smoking is bad for your health | But i love it |
+---+--------------------------------------+--------------------------+
将正确 ID 设置为旧值的唯一方法是 php+foreach?或者我忘记了与 sql/mysql 有什么关系来更快地自动获取正确的 ID 值?
感谢帮助。