Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: perfec2 on June 14, 2020, 07:53:56 AM

Title: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 07:53:56 AM
Hello Gurus,

When a person tries to register on my forum after putting all the detail and click submit below error occurs:

"Database Error
Please try again. If you come back to this error screen, report the error to an administrator."

Please how can I fix this?

Thank you in advance
Title: Re: Database Error Please try again.
Post by: Decent_946 on June 14, 2020, 08:05:33 AM
Are you using any mods to add/ask some additional data on registration? i.e country flags, pm on registration, etc. The issue seems to be with a DB query. Although reported before.

Also, check your forum error log - it will have more information on the specific error.
Title: Re: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 08:55:03 AM
Yes, I use mod to ask some questions as you mentioned. But I have disabled it, yet the problem still persists.

Below is the error log:

"[14-Jun-2020 12:45:11 UTC] PHP Deprecated:  Function create_function() is deprecated in /home/username/public_html/Sources/Load.php on line 273
[14-Jun-2020 12:45:12 Africa/Abidjan] PHP Deprecated:  Function create_function() is deprecated in /home/username/public_html/Sources/Subs.php on line 1088"
Title: Re: Database Error Please try again.
Post by: Doug Heffernan on June 14, 2020, 09:12:47 AM
What are your Smf and php versions?
Title: Re: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 09:15:16 AM
Quote from: Doug Heffernan on June 14, 2020, 09:12:47 AM
What are your Smf and php versions?

Version: SMF 2.0.17,  PHP 5.6
Title: Re: Database Error Please try again.
Post by: Doug Heffernan on June 14, 2020, 11:39:24 AM
Quote from: perfec2 on June 14, 2020, 09:15:16 AM
Quote from: Doug Heffernan on June 14, 2020, 09:12:47 AM
What are your Smf and php versions?

Version: SMF 2.0.17,  PHP 5.6

There you go. You must upgrade your php at least to 7.2 which is officially supported by Smf 2.0.17.
Title: Re: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 12:04:49 PM
Quote from: Doug Heffernan on June 14, 2020, 11:39:24 AM
Quote from: perfec2 on June 14, 2020, 09:15:16 AM
Quote from: Doug Heffernan on June 14, 2020, 09:12:47 AM
What are your Smf and php versions?

Version: SMF 2.0.17,  PHP 5.6

There you go. You must upgrade your php at least to 7.2 which is officially supported by Smf 2.0.17.

I have upgraded the PHP to 7.2, yet new users can't sign up.  The error is still showing.
Title: Re: Database Error Please try again.
Post by: lurkalot on June 14, 2020, 12:11:20 PM
Quote from: perfec2 on June 14, 2020, 12:04:49 PM
Quote from: Doug Heffernan on June 14, 2020, 11:39:24 AM
Quote from: perfec2 on June 14, 2020, 09:15:16 AM
Quote from: Doug Heffernan on June 14, 2020, 09:12:47 AM
What are your Smf and php versions?

Version: SMF 2.0.17,  PHP 5.6

There you go. You must upgrade your php at least to 7.2 which is officially supported by Smf 2.0.17.

I have upgraded the PHP to 7.2, yet new users can't sign up.  The error is still showing.

2.0.17 should work fine on php 5.6 anyway according to, https://wiki.simplemachines.org/smf/SMF2.0:Requirements_and_recommendations
Title: Re: Database Error Please try again.
Post by: Doug Heffernan on June 14, 2020, 12:18:39 PM
@perfec2, can you tell us what mods do you have installed? What was the latest change to the forum prior to this starting to happen?
Title: Re: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 12:30:59 PM
Yes my hosting allows switching to versions. But my issue persists, please what do I need to do so people can signup without issue?
Also where can I disable "OpenID" in the signup page?

Quote from: Doug Heffernan on June 14, 2020, 12:18:39 PM
@perfec2, can you tell us what mods do you have installed? What was the latest change to the forum prior to this starting to happen?

I am not sure when it started, but we moved to a new hosting. Also, I removed all the mods and uploaded SMF fresh files, no luck.
Title: Re: Database Error Please try again.
Post by: Doug Heffernan on June 14, 2020, 12:39:58 PM
Quote from: perfec2 on June 14, 2020, 12:30:59 PM
Yes my hosting allows switching to versions. But my issue persists, please what do I need to do so people can signup without issue?
Also where can I disable "OpenID" in the signup page?

Quote from: Doug Heffernan on June 14, 2020, 12:18:39 PM
@perfec2, can you tell us what mods do you have installed? What was the latest change to the forum prior to this starting to happen?

I am not sure when it started, but we moved to a new hosting. Also, I removed all the mods and uploaded SMF fresh files, no luck.

You can disable OpenID at the Settings page for the Registration. The setting you need for that is called: Allow users to register using OpenID

Did you run the repair_settings.php file after the move? If you did not, try to run it now and see if it would help.

https://wiki.simplemachines.org/smf/Repair_settings.php
Title: Re: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 01:43:06 PM
After moving to this new host, I did run Repair_settings.php and tried again now. But the error is still there.
Title: Re: Database Error Please try again.
Post by: Doug Heffernan on June 14, 2020, 01:58:54 PM
Can you attach here those 2 files mentioned in the error message? (Load.php and Subs.php)

P.s. Here you can read up on the cause of that particular error.

https://www.php.net/manual/en/function.create-function.php#:~:text=This%20function%20has%20been%20DEPRECATED,this%20function%20is%20highly%20discouraged.

Title: Re: Database Error Please try again.
Post by: perfec2 on June 14, 2020, 07:29:29 PM
The Load.php and Subs.php files attached.
Title: Re: Database Error Please try again.
Post by: Sir Osis of Liver on June 14, 2020, 10:10:51 PM
You shouldn't be getting 'Deprecated:  Function create_function()' in php 5.6.  Some crappy hosts will report incorrect php version.  Try running phpinfo.php (attached).
Title: Re: Database Error Please try again.
Post by: perfec2 on June 15, 2020, 06:59:27 AM
I uploaded the phpinfo.php,  the  PHP Version is 7.2.31
Title: Re: Database Error Please try again.
Post by: Sir Osis of Liver on June 15, 2020, 12:31:35 PM
The deprecated function error should not prevent registration.  If you've uploaded clean files the problem is either in your database or the server.  Can you get to server errorlog or view errors in cpanel?
Title: Re: Database Error Please try again.
Post by: perfec2 on June 18, 2020, 08:27:15 AM
I contacted the host, they replied: "I can find no cause of the error. A database restore does not fix it. Knowing what the database error is would be the best fix I believe".

I have done the following yet no fix:

I replaced all the SMF files
I updated to the latest version
Deactivated all mods and enable them back
My host copied all its files and database from the old VPS to this new one.
I switched to different PHP versions from 5.6 to 7.2 version, it still can't work.
New member can't sign up https://cokoye.com/register/
The forum is https://cokoye.com

I tried registering a new member from admin, and got the error:

"Field 'breeze_profile_views' doesn't have a default value
File: /home/username/public_html/Sources/Subs-Members.php
Line: 772

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.17, while your database is at version 2.0.13. The above error might possibly go away if you execute the latest version of upgrade.php."

What is the way out to fix this?
Title: Re: Database Error Please try again.
Post by: Arantor on June 18, 2020, 08:31:47 AM
Change the smf_members table, in the breeze_profile_views column, and allow it to be null.
Title: Re: Database Error Please try again.
Post by: perfec2 on June 18, 2020, 04:10:39 PM
Quote from: Arantor on June 18, 2020, 08:31:47 AM
Change the smf_members table, in the breeze_profile_views column, and allow it to be null.

I log into Cpnel, PHPMYADMIN I didn't see breeze_profile_views column, I only saw the following:
smf_breeze_comments
smf_breeze_notifications
smf_breeze_options
smf_breeze_status

Please can I PM you my Cpanel detail so that you help fix it?
Title: Re: Database Error Please try again.
Post by: Arantor on June 18, 2020, 04:18:52 PM
It's not a table called that, it's going to be the smf_members table looking at the error you have.

And please, no, I don't want cPanel logins - ever.
Title: Re: Database Error Please try again.
Post by: perfec2 on June 19, 2020, 05:40:16 AM
Please give steps on how to locate the breeze_profile_views column, and allow it to be null.

Thank you for your assistance.
Title: Re: Database Error Please try again.
Post by: Kindred on June 19, 2020, 09:52:58 AM
those are tables, not columns.

As Arantor said -- in the smf_members table, find the  breeze_profile_views  column and give it a default value of NULL
Title: Re: Database Error Please try again.
Post by: perfec2 on June 19, 2020, 01:52:53 PM
Quote from: Kindred on June 19, 2020, 09:52:58 AM
those are tables, not columns.

As Arantor said -- in the smf_members table, find the  breeze_profile_views  column and give it a default value of NULL
I understand, the question is how could I do that? Please put me through step by step and let me know the query to run or what?
Title: Re: Database Error Please try again.
Post by: Arantor on June 19, 2020, 03:01:05 PM
So you went into phpMyAdmin, right? Click on smf_members in the list of tables, then the Structure tab in that, you should then see the breeze_profile_views column. You can then edit that column, tick the box next to 'null' and hit save.
Title: Re: Database Error Please try again.
Post by: perfec2 on June 20, 2020, 07:44:48 AM
Quote from: Arantor on June 19, 2020, 03:01:05 PM
So you went into phpMyAdmin, right? Click on smf_members in the list of tables, then the Structure tab in that, you should then see the breeze_profile_views column. You can then edit that column, tick the box next to 'null' and hit save.


This solved it. 
Now new members can signup without issues.

Thank you Arantor, Sir Osis of Liver, Doug Heffernan, and all that contributed.