22.05.2017, 17:42
Quote:
That's normal. Auto-generated ID's do not get reset or reused. And with reason. For example, this very topic has id 634613 in the database. If it gets deleted then that ID does not get re-used. If it did get reused then all existing links to it would suddenly point to another topic. If you want to start from scratch you should use TRUNCATE TABLE. This deletes all the data and it also resets the auto-increment id. However I don't believe truncate will work if there are foreign keys.
Why? That's extremely counter intuitive. You already have the data so why (again) do you need to query for it? Also what's the deal with prefixing variables with "i"? When I see "i" in front of a variable I think "integer". This makes your code a bitch to read because none of those variables are integers. |
pawn Код:
ALTER TABLE DROP `somecolumname`
ALTER TABLE `sometable` ADD `id` INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`);