sof_user
sof_user

Reputation: 709

mysql , after a deletion, last inserted row sits just in the place of the deleted one

I am not going to paste the code here and hope the statement of the prob is enough to pose the question .

i inserted 3 rows in a mysql table, deleted the 2nd one and then inserted the 4th one and all these things i did by writing code in php. but the 4th one sits in the place of the deleted one. That is I wanted the order of the ids(primary key) to be 1,3,4. but now it becomes 1,4,3.

Thanks in advance for any solution.

Istiaque Ahmed Bangladesh

Upvotes: 0

Views: 208

Answers (2)

Paulraj
Paulraj

Reputation: 3397

Change the table storage engine to InnoDB.

MyISAM and InnoDB

Upvotes: 0

user557846
user557846

Reputation:

if you dont specify the sort order in your query then the db can return the rows in any order, so specify the sort order and all will be well

Upvotes: 2

Related Questions