Topic: Unable to create topic...

An error was encountered
File: f:\webserver\webdesign\forum\post.php
Line: 288

PunBB reported: Unable to create topic 

Database reported: Field 'question' doesn't have a default value (Errno: 1364)

I think it has something to do with the database. I use phpmyadmin to access the database, I have marked all tables and repaired them but there were no change at all sad

I would appreciate if someone could help me out I have tried to search but didn't find anything.

Re: Unable to create topic...

What values should I type in? I have opened the file post.php and found the line but I really don't know what to do?

This is line 288 in post.php

$db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());

Re: Unable to create topic...

What mod did you install that adds question to topics?

Re: Unable to create topic...

Smartys wrote:

What mod did you install that adds question to topics?

The only mod I have tried to install is the Easy Poll 1.3.

File: f:\webserver\forum\hej\poll.php
Line: 262

PunBB reported: Unable to create topic 

Database reported: Field 'yes' doesn't have a default value (Errno: 1364)

It seems like it's the php file that is incorrect or is it the mysql server?

Re: Unable to create topic...

EasyPoll 1.1.3 wink
Run the following SQL queries (replace prefix with your database prefix)

alter table prefixtopics change question question varchar(255) not null default ''
alter table prefixtopics change yes yes varchar(30) not null default ''
alter table prefixtopics change no no varchar(30) not null default ''

6 (edited by MEDiAHORAN 2006-05-20 22:10)

Re: Unable to create topic...

Smartys wrote:

EasyPoll 1.1.3 wink
Run the following SQL queries (replace prefix with your database prefix)

alter table prefixtopics change question question varchar(255) not null default ''
alter table prefixtopics change yes yes varchar(30) not null default ''
alter table prefixtopics change no no varchar(30) not null default ''

I think I left my prefix values blank during the punbb installation. Where can I see my database prefix? I'm administrating MySQL with phpmyadmin and I tried to run those commands with the database name in front of topics (I replaced the prefix as you said) but with no success. Well I guess I have to do a little bit of a research tomorrow big_smile

Re: Unable to create topic...

Where can I see my database prefix?

config.php

Re: Unable to create topic...

Smartys wrote:

Where can I see my database prefix?

config.php

Ok, $db_prefix = ''; so it should be like this

alter table ''topics change question question varchar(255) not null default ''
alter table ''topics change yes yes varchar(30) not null default ''
alter table ''topics change no no varchar(30) not null default ''

When I run it I get the following message:

MySQL said:  
#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 '''topics change question question varchar(255) not null default ''
alter table ' at line 1

Re: Unable to create topic...

Just topics without the '' wink

Re: Unable to create topic...

elbekko wrote:

Just topics without the '' wink

Hmm still doesn't seem to work, after I typed that in I got these results

Error

SQL query: 

ALTER TABLE topics CHANGE question question varchar( 255 ) NOT NULL default '' ALTER TABLE topics CHANGE yes yes varchar( 30 ) NOT NULL default '' ALTER TABLE topics CHANGE no no varchar( 30 ) NOT NULL default '' 

MySQL said:  
#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 'alter table topics change yes yes varchar(30) not null default''
alter table to' at line 2

Re: Unable to create topic...

lol, that is 3 seperate queries tongue
If you want to run them all at once, add a ; to the end of each
Otherwise, run them seperately

12 (edited by MEDiAHORAN 2006-05-21 18:29)

Re: Unable to create topic...

Smartys wrote:

lol, that is 3 seperate queries tongue
If you want to run them all at once, add a ; to the end of each
Otherwise, run them seperately

Thanks! I can now create topics again! Thanks! The only problem now is the poll plugin.

An error was encountered
File: f:\webserver\forum\hej\poll.php
Line: 265

PunBB reported: Unable to create poll 

Database reported: Field 'voters' doesn't have a default value (Errno: 1364)

I tried to run the same command but I replaced the topics with polls like this:

alter table polls change question question varchar(255) not null default '';
alter table polls change yes yes varchar(30) not null default '';
alter table polls change no no varchar(30) not null default '';

but it the following message appeared:

Error

SQL query: 

ALTER TABLE polls CHANGE question question varchar( 255 ) NOT NULL default '';


MySQL said:  
#1054 - Unknown column 'question' in 'polls'

I guess the values yes yes and no no shouldn't be there, well it's probably completely different commands in this case big_smile

I want to thank you all for helping me!

EDIT: Tried this command:

alter table polls change votes votes varchar(255) not null default ''

but it didn't make any difference...

EDIT 2: I'm such a idiot, why didn't I ran 'voters'? I tried this line

alter table polls change voters voters varchar(255) not null default ''

And it worked.

Thanks for all the help!