News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Database/subs-post.php error on Post after installing MODs

Started by URPG, April 06, 2006, 06:31:25 AM

Previous topic - Next topic

URPG

Hi there!

I get on posting and on sending PM:
Database Error: Duplicate entry '0' for key 1
File: /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Post.php
Line: 744


System:
SMF1.1RC2 (+Googlebot & Spiders Mod +Enhanced Move Tag +Fly Tag +More HTML tags +Custom Profile Mod +EmailFlash +CAPTCHA (code verification) +MessagePreviewOnHover +Ignore user +Karma On Memberlist +Merge Double Posts +Quick Upload +SMF 1.0.7 / 1.1 RC2 Update)

MKP1.1RC1 (+who download +MKP Statistics + Radio)

Tried to install but failed:
No Changing Moderator's Edit 0.3 error:
1024: Undefined XML element: search from /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Package.php on line 1409
File: /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Package.php
Line: 2791


Award Mod 1.1 error:
1024: Undefined XML element: search from /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Package.php on line 1409
File: /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Package.php
Line: 2791


Topic Ratings 1.03 error:
512: parseBoardMod(): The filename '$sourcdeir/Subs-Boards.php' is not a full path!
File: /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Package.php
Line: 1670


One of those Mod's must have messed up subs-Post.php
The Tag things are unlikely, but i got no idea. Any sugestions on how to install the 3 failed packages by hand and how to repair subs-Post.php? It does sound like a duplicate line or something, but i got no idea about this stuff...

All of those packages were downloaded yesterday from this server and i only clicked install if the test for installation was positive. (Still got those 3 errors and the posting Problem now).

You may want to check the site: urpg.info

Help! I already posted a re-direction in my old Forum...

URPG

Uploaded the subs-post.php to yousendit.com in case anyone want's to take a look :)

kegobeer

Have you recently moved your database to a new server?
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

URPG

YEs I have. I Exported the Database, uploaded it again on a new server (new domain, new database name). But i did fix the settings (Templates location, Database Excess, etc.)?

kegobeer

When you moved the database, the auto increment value was reset to zero in the personal_messages table.  You can fix this by executing the following SQL query in phpMyAdmin:

ALTER TABLE smf_personal_messages AUTO_INCREMENT = 1;

Replace smf_ with your table prefix.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

URPG

The Forum is displayed all right, tables were smf_ and are smf_

This is what i get from the uery:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AUTO INCREMENT = 1' at line 1

The only place i could find "auto increment" in phpMyAdmin was as checkbox option when i copy a table. Shall i copy this table, check the "add auto increment value" box, and use it to replace the old table?

Sorry for the slow answer, it is actualy quite urgent, but i was away from any internet for 2 days...

kegobeer

Sorry, typo on my part.  It should be AUTO_INCREMENT = 1, not AUTO INCREMENT = 1.  Forgot the underscore.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

URPG

The query was exectued Successful (sorry, could have noticed the underscore myself if i would know some more about SQL) but i get

Database Error: Duplicate entry '0' for key 1
File: /hp/aa/ae/eq/www/urpg/smf/Sources/Subs-Post.php
Line: 744


on posting PM or Messages to the Forum :(

URPG

I get the same error in subs.php if i try to edit the Forum News. News are changed, but i get this error message, PM and Posts are not working it seems.  :'(

kegobeer

Use phpMyAdmin to examine the structure of the messages table - ID_MSG should not have a default value, and auto_increment should be in the extra field.  You'll probably have to examine all of your SMF tables and look for the same thing.  Exclude the following tables (they have no auto increment key):

board_permissions
collapsed_categories
all of the log_ tables except for log_actions, log_banned, and log_errors
moderators
permissions
pm_recipients
poll_choices
sessions
settings
themes

"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

URPG

Example: smf_attatchments has: ID_MSG int(10) ... default 0 ... no field "auto_increment"

so i execute

ALTER TABLE smf_attatchments AUTO_INCREMENT = 1;

and go to check the next table?

kegobeer

You can use phpMyAdmin to edit the table structure instead of executing the query.  For example, in the attachments table, view the structure and then click the pencil icon in the ID_ATTACH row.  You can then select auto_increment in the extra field, and delete the 0 from the default value field.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

kegobeer

To prevent this in future backups/restores/moves, when using phpMyAdmin make sure "Add AUTO_INCREMENT Value" is checked during the export process.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

URPG

The database is still on the old server! I cannot use phpmyadmin to DL it because gZIP compression is disabled and it's >2 MB but i can get it with SMF uncompressed export... I am rather sure i let SMF export the databse to sql file in the first place...

URPG

Did fix smf_attatchments (ID_attatch: deleted the 0). and smf_messages (ID_msg: delted 0, set auto increment)...

Still get that error?!

Do i have to kill all the 0's in the default boxes?

I did create the SQL file with SMF and uploaded it by opening the remote DB on the new server with mySQL-Front and importing the smf_tables. Could this have caused the trouble? Then i can change some settings and just import again?

kegobeer

You'll have to go thru all the tables.  You'll then have to reset the auto_increment value with ALTER TABLE xxx AUTO_INCREMENT = 1;

If you PM me your sql file I'll take a look at it.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")


sharkk

Quote from: kegobeer on April 09, 2006, 01:17:25 PM
You can use phpMyAdmin to edit the table structure instead of executing the query.  For example, in the attachments table, view the structure and then click the pencil icon in the ID_ATTACH row.  You can then select auto_increment in the extra field, and delete the 0 from the default value field.
I've a similar problem, but when I do this,

ALTER TABLE `smf_permissions` CHANGE `ID_GROUP` `ID_GROUP` SMALLINT( 6 ) NOT NULL AUTO_INCREMENT

MySQL meldet:
#1582 - ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '2-search_posts' for key 'PRIMARY'


QuoteUpdating Settings.php... Successful.
Creating new tables and inserting default data...
    Creating "themes"... done.
    Creating "collapsed_categories"... done.
    Creating and verifying "permissions"... done.
    Inserting data into "permissions"... Unsuccessful!
This query:

    INSERT INTO smf_permissions
    (ID_GROUP, permission)
    VALUES (-1, 'search_posts'), (-1, 'calendar_view'), (-1, 'view_stats'), (-1, 'profile_view_any'),
    (2, 'calendar_post'), (2, 'calendar_edit_any'), (2, 'calendar_edit_own');

Caused the error:

    Duplicate entry '-1-search_posts' for key 'PRIMARY'

can you help me out of this?

thanks
rakso

redone

I would attempt to insert the query via phpmyadmin and run the upgrade again. There are many potential issues, your version of MySQL, whether all the required fields have auto_increment set and potential duplicate enteries.

I generally insert the information by hand if the automatic process fails.


Advertisement: