Invalid Posts

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
User avatar
itsonlybarney
Registered User
Posts: 238
Joined: Sun Apr 10, 2005 5:06 am
Location: /home/Sydney/public_html
Contact:

Invalid Posts

Post by itsonlybarney »

I installed the latest version (2.0.20) the other day and when I went to add some posts to the forum I can add one and when I go to view the post it says that it is invalid.

The first post is valid and has a post_id of 1 but the next post I add has a post_id of 0 and I can't access it.

And when I try to add another post I get this error:

Code: Select all

Error in posting

DEBUG MODE

SQL Error : 1062 Duplicate entry '0' for key 1

INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('How to Post in Extended Discussion', 2, 1148546914, 3, 0, 2, 0)

Line : 226
File : functions_post.php
Enjoy talking about trains?
User avatar
itsonlybarney
Registered User
Posts: 238
Joined: Sun Apr 10, 2005 5:06 am
Location: /home/Sydney/public_html
Contact:

Post by itsonlybarney »

I appear to have worked out the problem. The problem is in mysql_schema.sql

I believe this is the problem code:

Code: Select all

CREATE TABLE phpbb_posts_text (
   post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
   bbcode_uid char(10) DEFAULT '' NOT NULL,
   post_subject char(60),
   post_text text,
   PRIMARY KEY (post_id)
);
And I changed to:

Code: Select all

CREATE TABLE phpbb_posts_text (
   post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
   bbcode_uid char(10) DEFAULT '' NOT NULL,
   post_subject char(60),
   post_text text,
   PRIMARY KEY (post_id)
);
Enjoy talking about trains?
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

Tables with auto_increment columns:

phpbb_groups => group_id
phpbb_banlist => ban_id
phpbb_categories => cat_id
phpbb_disallow => disallow_id
phpbb_forum_prune => prune_id
phpbb_posts => post_id
phpbb_privmsgs => privmsgs_id
phpbb_ranks => rank_id
phpbb_search_wordlist => word_id
phpbb_smilies => smilies_id
phpbb_themes => themes_id
phpbb_topics => topic_id
phpbb_vote_desc => vote_id
phpbb_words => word_id

As you can see, posts_text is not one of the tables that should have an auto_increment, because its post_id variable should always match its entry in the posts table. If you're getting a zero when you get to the insertion of the text, something went wrong with the insertion of the post information!
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
User avatar
itsonlybarney
Registered User
Posts: 238
Joined: Sun Apr 10, 2005 5:06 am
Location: /home/Sydney/public_html
Contact:

Post by itsonlybarney »

Should the line

Code: Select all

post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
not have DEFAULT '0' in it??

That code with DEFAULT '0' is in the standard mysql_schema.sql in the default download from here the other day.
Enjoy talking about trains?
User avatar
Lumpy Burgertushie
Registered User
Posts: 67898
Joined: Mon May 02, 2005 3:11 am
Contact:

Post by Lumpy Burgertushie »

you are not changing anything when you edit that file. that is the file that is used when the database is created. editing it has no affect on the database at all unless you then run those queries on the database.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
itsonlybarney
Registered User
Posts: 238
Joined: Sun Apr 10, 2005 5:06 am
Location: /home/Sydney/public_html
Contact:

Post by itsonlybarney »

I editted those files and then updated the database using the updated sql file on a default install and it works fine now....
Enjoy talking about trains?
Locked

Return to “2.0.x Support Forum”