Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

ERROR Integrity constraint violation 1062 Duplicate entry 'here a number' for key 'PRIMARY' #214

Closed
BigTwoProduction opened this issue Jun 8, 2016 · 10 comments

Comments

@BigTwoProduction
Copy link
Contributor

Hello,

So today and once again PHP 7....

[08-Jun-2016 12:43:31] USER ERROR: "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '20' for key 'PRIMARY'
Query-Code:INSERT INTO uni1_log_fleets SET
fleet_id = 20,
fleet_owner = 1,
fleet_target_owner = 7,
fleet_mission = 6,
fleet_amount = 1,
fleet_array = 210,1,
fleet_universe = 1,
fleet_start_time = 1465382616,
fleet_end_stay = 1465382616,
fleet_end_time = 1465382621,
fleet_start_id = 1,
fleet_start_galaxy = 1,
fleet_start_system = 1,
fleet_start_planet = 2,
fleet_start_type = 1,
fleet_end_id = 7,
fleet_end_galaxy = 1,
fleet_end_system = 5,
fleet_end_planet = 4,
fleet_end_type = 1,
fleet_resource_metal = 0,
fleet_resource_crystal = 0,
fleet_resource_deuterium = 0,
fleet_group = 0,
fleet_target_obj = 0,
start_time = 1465382611;"
File: /var/www/html/xnovareborn/includes/classes/Database.class.php | Line: 109
URL: http://www.big-two.tk/xnovareborn/game.php?page=fleetAjax&ajax=1&mission=6&planetID=7 | Version: 1.8.git
Stack trace:

0 /includes/classes/Database.class.php(168): Database->_query('INSERT INTO uni...', Array, 'insert')

1 /includes/classes/class.FleetFunctions.php(630): Database->insert('INSERT INTO %%L...', Array)

2 /includes/pages/game/ShowFleetAjaxPage.class.php(215): FleetFunctions::sendFleet(Array, 6, '1', '1', '1', '1', '2', '1', '7', 7, '1', '5', '4', '1', Array, 1465382616, 1465382616, 1465382621)

3 /game.php(57): ShowFleetAjaxPage->show()

4 {main}

Any idea ?

Best regards,
Jordan.

@jkroepke
Copy link
Owner

jkroepke commented Jun 8, 2016

Reproduable?

@jkroepke
Copy link
Owner

jkroepke commented Jun 8, 2016

I wonder why you have more errors in PHP7 as in PHP5. My test instance is PHP7, too.

@BigTwoProduction
Copy link
Contributor Author

I don't know but yes reproducible .... For each fleet send :/

@jkroepke
Copy link
Owner

jkroepke commented Jun 8, 2016

Please post the results from this queries:

SHOW CREATE TABLE uni1_fleets;
SELECT MAX(fleet_id) FROM uni1_log_fleets;

@BigTwoProduction
Copy link
Contributor Author

MAX(fleet_id)=4801

@jkroepke
Copy link
Owner

jkroepke commented Jun 8, 2016

And the first query?

@jkroepke
Copy link
Owner

jkroepke commented Jun 8, 2016

Did you move your database restore your database from a backup?

@BigTwoProduction
Copy link
Contributor Author

Yes i've restore my database ? that why cause problem ?

@jkroepke
Copy link
Owner

jkroepke commented Jun 8, 2016

Yes. How did you make Backups? Your Backups does not include the AUTO INCREMENT value of a table. To fix this, run

ALTER TABLE uni1_fleets AUTO_INCREMENT = 4802

@BigTwoProduction
Copy link
Contributor Author

Yeah you've right ! Awesome ! No more error.

Stay tuned,

Thanks,
Jordan.

@jkroepke jkroepke closed this as completed Jun 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants