1つのテーブルに2つのフィールド(タイトル、コンテンツ)があり、いくつかの値を挿入しました...:
+--------------------------------------+--------------------------+
| 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ですか?または、正しいID値をより速く自動的に取得するためにsql / mysqlとの関係を忘れましたか?
手伝ってくれてありがとう。