As soon as I try to add questions in the questionarre module it gives me an "Error writing to database"
What do I do?
Hi Austin,
As you can guess, this is not the "normal" behaviour of the Questionnaire module. There is no way we can help if you do not provide more details.
Joseph
1) I'm talking about the Questionnaire activity.
2) The latest version of Moodle -- I think 2.0
3) I turned on debug but It didn't display any more information than before.
4) Yes, it is.
Can I give you login creditals for my site?
Austin
I'm having the same problem - using Moodle 2.1.
I thought it might be a MYISAM InnoDB issue, so I changed all database fields to InnoDB, same error - I can add 2 questions then I get the same error message
So
Ran a debug - got this exception message
Debug info:
Duplicate entry 'aäa' for key 2 INSERT INTO mdl_unit_table (name) VALUES(?) [array ( 0 => 'aäa', )]
After resolving issues with Mysql and Ioncube with the support team at SITE5 (who have been brilliant) I still have the "error writing to database" message - They asked if I could check this issue with the module developers:
"Now, the issue with Zend Optimizer is that your script could be not up to date. Is there any possibility you could upgrade that module? From what I see in the error log we (SITE5) are using a newer version of Zend Optimizer which your mod doesn't support."
is this a module related issue or a wider moodle issue?
thanks
Nyree
Sorry, Nyree, I have no idea why you should have this problem with the Questionnaire plugin on your moodle site. As far as I know this plugin does not use the database in ways that are different from other moodle core files or 3rd-party plugins.
Are you getting an "error writing to database" with any other plugins on your moodle site?
Are you certain you have the Questionnaire version for moodle 2.1?
Is your moodle site a clean installation of moodle 2.1 or an upgrade (from 1.9.x)?
Can you describe step by step the scenario which leads to the problem? From creating question 1 to more questions; which question type; the contents of the questions, etc. The complete error messages you are getting (with debug set ON to full messages).
Joseph
Are you getting an "error writing to database" with any other plugins on your moodle site? NO
Are you certain you have the Questionnaire version for moodle 2.1? YES, I've already created a questionnaire successfully
Is your moodle site a clean installation of moodle 2.1 or an upgrade (from 1.9.x)? CLEAN INSTALL
Can you describe step by step the scenario which leads to the problem?
I created 2 question (radio buttons)
then I tried to create a drop-down question. On save it gives "error writing to database" message
changed database to from MyISAM to InnoDB
Managed to create a test drop-down question
Tried a new drop-down question - same error again
I have a screencast showing the successful question creation and then the unsuccessful attempt I could post this but its a large file.
Contacted SITE5 technicians who don't think its a mysql issue but rather an outdated Zend Engine API
can you shed any light on this?
thanks
Nyree
Hi Nyree,
Sorry, I have no idea what a "Zend Engine API" is. Could you put your screencast on the Web somewhere and give us a link to it?
Joseph
That is not a Questionnaire problem, but an mysql problem, see this discussion.
We also had this problem; it seems to be an issue with the 'value' field in questionnaire_quest_choice: the XML schema specifies that this field can be null, but our database (which has been upgraded over time) had this field set to NOT NULL. When creating new entries in this table the 'value' is not specified in questions.php (approx. line 390 in our copy of this file), so this was causing a write failure.
Joseph, I guess this is something that needs changing in db/upgrade.php? I don't know how many people it will affect, though.
Austin, the way I fixed this was to run the following command within MySQL:
alter table mdl_questionnaire_quest_choice modify value text null;
If you are not running MySQL or your database prefix is not 'mdl' then you'll need to alter this, but allowing null values should fix it.
Hope this is helpful.
Tom
Thanks for the update, Tom.
Since I am not at all a database specialist, I leave it to my questionnaire co-maintainer, Mike, to fix things.
Any-one interested in a fix please vote in the Moodle bug tracker for CONTRIB-3241.
Joseph
I'm still getting the error writing to database" message and the last word from the site5 technicians is
"this issue being more likely script related, we would recommend checking with the Moodle community for more information"
So does anyone have any suggestions as to what could be happening here,? I've previously created a questionniare with no problem, using the same moodle installation version.
Any help gratefully received!
Nyree
When you say 'still', do you mean after altering the database as suggested? If you've already tried this, could you please post the output of the command "describe mdl_questionnaire_quest_choice;" from within MySQL. The way you describe the problem it certainly sounds like the same issue, but it's possible there's a different cause.
Thanks,
Tom
Hi Tom
Yes, I ran the script you suggested. No change.
Here's the output of the command:
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | bigint(10) unsigned | NO | PRI | NULL | auto_increment |
question_id | bigint(10) unsigned | NO | 0 | ||
content | text | NO | NULL | ||
value | text | YES | NULL |
thanks for your input
Nyree
Still getting the same error message when creating questions
can I just check that I'm using the latest version of the module, compatible for Moodle 2.1?
<?php // $Id: version.php,v 1.39 2010/11/25 20:51:16 mchurch Exp $
Could anyone post a screenshot of their mysql questionnaire fields so that I can see if there are any differences?
Thanks
Can I safely delete all the questionnaire fields and the module itself and try reinstalling?
Any suggestions?
thanks
Nyree
Hi everyone
After 2 weeks of tests, upgrades etc trying to database I think the problem may be solved.....
For easy future reference I was duplicating the question name and the question text eg
'Which do you use as your primary source of news?'
It appears that the questionnaire throws up the database error message if the question NAME is longer than a certain limit.
Shorter question names have been 100% successful (so far)...fingers crossed!
Happier (mais épuisée)
Hi Nyree,
Well-spotted.
Reported as CONTRIB-3252 and fixed. Thanks for the report!
Joseph
PS.- May I point out, however that the question name field was never meant to contain longish question names but a string as short as possible, only used in the export data, in order to not clutter column names in a spreadsheet?