InMotion Hosting Support Center

Moodle CSV error uploading to database

Category: Databases

2013-11-10 7:32 am EST

Hits: 1,791
when i upload users under csv file, when i click update the list, i get this error..."Error writing to database"...what is wrong with this, and how do i correct it?
kindly help. thanks

You must login before you can ask a follow up question.

You must login before you can submit an answer.



11,186 Points
2013-11-11 8:59 am EST
This error can be caused by a multitude of reasons. What specific errors are displayed on the page?

Most commonly, be sure that your database information defined within Moodle match the correct database user, password, and database name that you have set up.

You must login before you can post a comment about this answer.

hallo Jeff.
thanks for your response. i have counter checked the file like 10 times and the username, password is all set up correctly...i honestly have no idea wht the problem would be, i will be glad if you can help me sort it out kindly.

20 Points
2013-11-14 1:53 pm EST
Hello mcuack,

I did some further digging on this Moodle issue that you're having, and do you happen to have any custom user profile fields that are set to be *required* in Moodle? If so, your CSV file might possibly not match up with all of these required fields and lead to the problems you're having.

If that's not the case, it looks like there is another possible solution up on the moodle forums from earlier this year regarding Bulk upload users error where one user mentioned this as a fix:

"When I tried this out, I made two changes to your file - I added a role field so that when the 'upload user' enrols the user to the course it knows what role to give them, I also converted it to comma separated rather than tab separated.

You could also try to enable Moodle debugging from Settings > Site administration > Development > Debugging to see if you're getting another specific error that might lead in a more clear solution to a resolution.

Let us know if any of that works for you.

- Jacob
9,968 Points
2013-11-14 2:15 pm EST
hallo Jacob.
Thanks for the response. I had gone through that forum discussion, to respond to your suggestion....its true that there are some customised fields, which i have ensured that I have captured them correctly in my csv, i am not sure that is the main problem.

on activating the debugging mode on the development session as you sugested, when i click afresh to upload the file, this is the error its throwing to me at an initial stage of uploading......

"""Invalid JSON string
Notice: Undefined index: defaultregion in /home/sukuul/public_html/elearner1/lib/outputlib.php on line 1228

How do you suggest we should correct this, and could it be the reason for the error?
Thanks alot for your help great people.

20 Points
2013-11-14 2:31 pm EST
Hello again mcuack,

Do you happen to be running the Rocket theme, or another custom theme? I ran across another Moodle forum post regarding Notice: Undefined index: defaultregion in /home/mysite/public_html/lib/outputlib.php on line 1228. In that thread someone mentions this as a possible solution:

"Go to Theme Seletor and choose another theme. Standard might be better as this is a stable theme.

Next remove Aardvark from the Theme directory.

Next go to Settings > Site Administration > Development > Purge all caches

Purge the cache by clicking on the button on that page. When the page reloads, click the button again, and when the page reloads again go back to your Home page, and test to see how Standard theme renders the page"

Let us know if that does the trick for you.

- Jacob
9,968 Points
2013-11-14 2:53 pm EST
I followed your instructions step by step...and it seems i am getting the same error on database. The only difference is that, i dont have the theme ""Aardvark"" from my theme directory. So I still cant seem to sort this out yet. Kindly help me out still sir.

Thanks alot.
20 Points
2013-11-14 3:53 pm EST
Hello mcuack,

Just to clarify again, those aren't our instructions, but another Moodle user posting on the Moodle forums about getting the same error. In their particular case, they had the Aardvark theme. That's why I asked if you happened to be using a theme other than the standard Moodle one to see if you were having similiar issues.

You can follow our guide on changing the default Moodle theme which describes going to Settings > Site administration > Appearance > Themes > Theme selector from the left-hand menu, and it should show you what theme you're currently using.

Also it would help to know the type of server you're running Moodle on, are you a customer of ours because I was unable to find your email in our system? If you'd like us to assist you further it would help to know the domain in question where you are having these problems at. Have you made any modifications at all to the Moodle core files, as that could be leading to these issues as well and would be helpful to know about.

- Jacob
9,968 Points
2013-11-14 4:35 pm EST
Hallo Jacob,
Thanks alot for your help, i really appreciate, I am hosted by Hostgator... My server is a Linux server, i have not really made any changes to me moodle core files since i installed it, so i dont think thats the reason, ..its true, i use the custom theme of website with the moodle site is:

if you can help,, i will honestly appreciate. thanks again.

20 Points
2013-11-14 4:47 pm EST
Hello mcuack,

Do you have the latest version of the Rocket theme for Moodle? That Moodle forum post I linked to before was with that exact same theme and showing the exact same error. Here you can see the Undefined index: defaultregion error being reported, and if you look 2 posts down there is someone saying "Your reported bug is fixed. "

I would recommend either getting in contact with the theme developer or your web host to see what might need to be done past this point, as it doesn't seem this is probably an issue with Moodle itself and it would be very hard for us to troubleshoot without being able to replicate the hosting environment.

- Jacob
9,968 Points
2013-11-14 8:02 pm EST
THANKS very much Jacob, let me see if i can be able to get a solution for this. I really appreciate the kind gesture. regards.
20 Points
2013-11-15 1:07 am EST
Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

Social Login Joomla

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!