Page 1 of 1

Invalid Posts

Posted: Thu May 25, 2006 8:46 am
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

Posted: Thu May 25, 2006 8:59 am
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)
);

Posted: Thu May 25, 2006 2:31 pm
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!

Posted: Fri May 26, 2006 7:09 am
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.

Posted: Fri May 26, 2006 8:15 am
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

Posted: Fri May 26, 2006 9:53 am
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....