error while Adding a new Quiz in course moodle 2.9

error while Adding a new Quiz in course moodle 2.9

by neha pal -
Number of replies: 14

error while  Adding a new Quiz in course moodle 2.9

Adding a new Quiz getting Error writing to database

I click on course and add thi quiz in that bt while saving that quiz m gtng Error writing to database in /course/modedit.php

Plz Help me with it



Error writing to database

More information about this error


Average of ratings: -
In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Rodney Wolford -
Hello,

Did you check out this link? In particular look at Ken Task's recommendations.

https://moodle.org/mod/forum/discuss.php?d=230681#p1001751


Rod

In reply to Rodney Wolford

Re: error while Adding a new Quiz in course moodle 2.9

by neha pal -
Hello,


Yes,I checked it bt m nt finding that my.inf and my.cnf so m not understanding that answer...



and one more thng in my phpmyadmin mood_course table has the modinfo and sectioncache ....

and when i adding a new course this both the field showing NULL value bt actually this field should have  data  like  this: a:1:{i:31;O:8:"stdClass":12:{s:2:"id";s:2:"17";s:2....... idnt knw this all is related to my error or not bt i notice this  kindlly plz rply

In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Rodney Wolford -

Hello again,

As Ken also says, "If you are remotely hosted on a shared server, you may NOT be able to add any my.cnf file to control the database server ... which is also shared by multiple customers.  Most setups like that *are* restricted ... that's why they are so cheap!  ** You must contact your provider and inquire about increasing max_packets for your setup. **"

I can't say what your error message means, but I might recommend you can get a more complete error message reporting if you go to your Moodle Administration tab, select "Site Administration"  > "Development" > Debugging and in the Debug Messages drop down select either "Show all reasonable PHP debug messages" or even take the "Developer Option." Also on that page you can click "Display debug messages" to get a more comprehensive set of errors.

Also, when you report errors it is usually important to include the whole error. Some of the error results may contain information useful to those who can help you, but meaningless to you.

Hope this helps some.

Rod

In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Rob Johnson -

I suggest turning on debugging and triggering the error again.  You will get more information that will help pinpoint the cause.  If it is a max packet setting causing it, it will be mentioned specifically in the error stack trace. 

In reply to Rob Johnson

Re: error while Adding a new Quiz in course moodle 2.9

by neha pal -

 hello,

Thanks for rply,

  I try it n it showing the error like this 


Debug info: Field 'questions' doesn't have a default value

INSERT INTO mood_quiz (name,timeopen,timeclose,timelimit,overduehandling,graceperiod,grade,attempts,grademethod,questionsperpage,navmethod,shuffleanswers,preferredbehaviour,canredoquestions,attemptonlast,showuserpicture,decimalpoints,questiondecimalpoints,showblocks,subnet,delay1,delay2,browsersecurity,course,intro,introformat,timemodified,password,reviewattempt,reviewcorrectness,reviewmarks,reviewspecificfeedback,reviewgeneralfeedback,reviewrightanswer,reviewoverallfeedback) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

[array (

0 => 'computer test',

1 => 0,

2 => 0,

3 => 0,

4 => 'autoabandon',

5 => 86400,

6 => 10,

7 => '0',

8 => '1',

9 => '1',

10 => 'free',

11 => '1',

12 => 'deferredfeedback',

13 => '0',

14 => '0',

15 => '0',

16 => '2',

17 => '-1',

18 => '0',

19 => '',

20 => 0,

21 => 0,

22 => '-',

23 => '16',

24 => '',

25 => '1',

26 => 1445232368,

27 => '',

28 => 69904,

29 => 69904,

30 => 69904,

31 => 69904,

32 => 69904,

33 => 69904,

34 => 4368,

)]

Error code: dmlwriteexception

Stack trace:

line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown

line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()

line 89 of /mod/quiz/lib.php: call to mysqli_native_moodle_database->insert_record()

line 121 of /course/modlib.php: call to quiz_add_instance()

line 275 of /course/modedit.php: call to add_moduleinfo()






so wt to do with it ????

In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I am guessing:

  • you recently upgraded from an older version of Moodle to Moodle 2.8 or later
  • you did not actually complete the upgrade by visiting Admin -> Notificaitons.

Therefore, the database structure does not match what it should be.

See Upgrading for the correct way to upgrade Moodle.

In reply to Tim Hunt

Re: error while Adding a new Quiz in course moodle 2.9

by neha pal -
Yes i upgrade this to 2.9.2 can u please help me to slove this
In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Read the Upgrading instructions I linked to.

Probably what you need to do is to log in as Admin, and go to Site administration -> Notifications, and go through that.

In reply to Tim Hunt

Re: error while Adding a new Quiz in course moodle 2.9

by neha pal -

actually i instaled a new version and thn i insert the whole values in database.... i hvnt upgrade

In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Well, the error is indicating that you have done something wrong in the database and one of the fields requires a default value.

You need to upgrade properly.  I suggest restoring everything back to before the upgrade and then running the upgrade correctly.

In reply to Emma Richardson

Re: error while Adding a new Quiz in course moodle 2.9

by neha pal -

M gtng this error in notification

Last check done on 10 October 2015, 9:33 AM
Enabling the PHP setting display_errors is not recommended on production sites because some error messages may reveal sensitive information about your server.
The cron.php maintenance script has not been run for at least 24 hours. Help with Cron

In reply to Emma Richardson

Re: error while Adding a new Quiz in course moodle 2.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That is the wrong interpretation Emma.

That column does not exist in the Moodle 2.8+ database. It did exist in the 2.7- database, but an upgrade step removed it.

In reply to neha pal

Re: error while Adding a new Quiz in course moodle 2.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That will not work.

If you want to move to the latest Moodle, and keep all your data from a previous version, then you need follow the upgrading instructions.

Doing what you tried to do cannot possibly work, as you found.