Breez
AKA: badhq
+937|6849|Derby, England

Hey guys I have a small problem every time I try to make thread on my site it spits out this error

Code:

SQL ERROR [ mysql4 ]

Duplicate entry '23273' for key 1 [1062]

SQL

INSERT INTO phpbb_posts (forum_id, poster_id, icon_id, poster_ip, post_time, post_approved, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, post_username, post_subject, post_text, post_checksum, post_attachment, bbcode_bitfield, bbcode_uid, post_postcount, post_edit_locked, topic_id) VALUES (30, 2, 0, '86.155.131.181', 1231640088, 1, 1, 1, 1, 1, '', 'jhskjhd', 'sadasdasbkjdaskjdbj lksahdjklashd', '99d7823afca60945a1f04be4baefac73', 0, '', 'ianxkgay', 1, 0, 21707)

BACKTRACE


FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions_posting.php
LINE: 1871
CALL: dbal_mysql->sql_query()

FILE: posting.php
LINE: 1001
CALL: submit_post()
ANy help please?
mikkel
Member
+383|6819
Looks like you're trying to create a row with a duplicated value in a unique column. Can you show us your datatypes?

Last edited by mikkel (2009-01-11 02:51:45)

Breez
AKA: badhq
+937|6849|Derby, England

mikkel wrote:

Looks like you're trying to create a row with a duplicated value in a unique column. Can you show us your datatypes?
not sure what u mean by data type ? ( I'm not really an sql expert ) It usualy happends when i try and make new thread and submit post


Where do I get datatypes from ?
mikkel
Member
+383|6819
I just had a look in some old phpBB database backup I had lying about, but it seems like you're on phpBB2, so the data structure is somewhat different from what I've got here. I don't know phpBB2 too well, but there should be some sort of option in the administration interface to synchronise your posts and threads, which might just fix your problem.

Last edited by mikkel (2009-01-11 03:09:17)

Titch2349
iz me!
+358|6570|uk

Not sure if this will work.... but you could go into the database and increase the "Auto Increment" amount by a couple of hundred for the column causing the issue, which should make it miss out the numbers that are conflicting.
Harmor
Error_Name_Not_Found
+605|6766|San Diego, CA, USA

Titch2349 wrote:

Not sure if this will work.... but you could go into the database and increase the "Auto Increment" amount by a couple of hundred for the column causing the issue, which should make it miss out the numbers that are conflicting.
^^this

Run this and it will alter your table's primary key (I'm assuming its the forum_id column) to +1 the maximum value:

Code:

SET @nextForumId = 0;
SELECT @nextForumId := MAX( forum_id )+1 FROM phpbb_posts;
SET @sql = CONCAT("ALTER TABLE phpbb_posts AUTO_INCREMENT = ", @nextForumId );
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
Or manually run:

Code:

SELECT MAX( forum_id ) FROM phpbb_posts;
and then

Code:

ALTER TABLE phpbb_posts AUTO_INCREMENT = {+1 the result of the previous query};

Board footer

Privacy Policy - © 2024 Jeff Minard