Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: fox0r on August 04, 2009, 10:46:39 PM

Title: Database Error
Post by: fox0r on August 04, 2009, 10:46:39 PM
I upgraded from 2.0 beta.. 3 I think it was, to 2.0 RC1.2.  Everything seems to be working fine but topic viewing.

To upgrade i just wiped my forum folder and installed the new version -- it was all nasty from botched mods, so i figured a clean install would do it good.

I installed, and it went fine, I just put in my database details, it connected and worked fine.

The error I got when trying to view a topic said something about running the upgrade.php to update the database, and so I did.

Now I'm getting this:

Unknown column 'a.file_hash' in 'field list'
File: /usr/home2/jpohlman/public_html/htss/Sources/Display.php
Line: 994


How do I fix it?
Title: Re: Database Error
Post by: fox0r on August 04, 2009, 11:20:37 PM
Okay, I fixed this, then I logged out to test a mod, and now I can't log back in.

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.
Title: Re: Database Error
Post by: fox0r on August 04, 2009, 11:34:54 PM
I ran the updateDatabase.php and if it did anything I can't tell.

I really need to get my forum running, if someone has some ideas that would be great.
Title: Re: Database Error
Post by: Norv on August 05, 2009, 02:01:30 AM
updateDatabase.php should have helped get rid of the "unknown column 'a.file_hash' error", as it updates your database structure to a version 1.1.9+, where this column exists.

About the error you are receiving now, can you please make sure you copy here all the error message or make a screenshot?
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 02:05:57 AM
I try to log in, and that is seriously all it says.  It doesn't give any more information or anything like the last one did.  Even if I try to log in with an account name/password that doesn't exist it gives the same thing.

The URL it spews is http://www.bqinternet.com/~jpohlman/htss/index.php?action=login2
Title: Re: Database Error
Post by: Norv on August 05, 2009, 02:17:22 AM
You might try to make another account, then make it admin using the advices here:
I accidentally deleted my admin account, what do I do? (http://docs.simplemachines.org/index.php?topic=466)

Then at least you can have access to see what is wrong, see a complete error log that hopefully will help understand what is the problem with the other account. (it seems one member is logged in right now, so perhaps login still works on some accounts)
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 02:20:51 AM
I have another admin user, but he isn't around.

Any time I try to log in with anything it gives me that message, though, so if he's timed out/logged out/etc we're in trouble. The board is set up for approval for new members.

The admin panel is different than what I'm used to, do you have the step-by-step to get into where the logs are?  I can email him and have him see if he can get into it and paste me what it says.
Title: Re: Database Error
Post by: Norv on August 05, 2009, 02:25:47 AM
I was referring to you registering another account yourself (temporary), log in on forum, then tweak permissions in the database as explained in the topic linked above, to have admin access. Thus you will be able to access your forum and see for yourself what the issues may be.
The error log is in the Admin panel, Maintenance > Logs.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 02:28:39 AM
I don't have access to PHPMyAdmin to run SQL queries :(  I don't think shell is set up for the user, either.  It's my buddy's forum that I admin and help him with, and he doesn't even know what SQL is I don't think -- He's not very web savvy, let's leave it at that.

I'll have to email him and see if he can get me the error log.

But, if I can't log in with any string of user names/passwords, I don't see what making a new account will do?
Title: Re: Database Error
Post by: Norv on August 05, 2009, 02:41:25 AM
You mean you checked other accounts?

As I said, I just saw a member logged in, when I visited the forum, so I suppose some accounts can still log in.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 02:44:56 AM
I think the ones that are logged in are the ones who are still cookied and didn't actually log out.  After I reinstalled/ugraded I was still logged in.  As I mentioned before, I logged out to check a mod (It was a hide content from guests tag) and wasn't able to get back in.

I emailed the other admin, hopefully he'll get me the log stuff soon so I can post it.
Title: Re: Database Error
Post by: Norv on August 05, 2009, 02:50:35 AM
Normally a user is only shown as logged in if active during the last 15 minutes, but yes, obviously I don't know since when they keep being logged in. Either way, please feel free to post any updates that may help understanding the issue.
Title: Re: Database Error
Post by: Norv on August 05, 2009, 09:36:13 AM
Update: I just visited the forum again and cannot log in with the test account I had created.
Please try this: backup your file ./Sources/LogInOut.php, and replace it with a fresh copy with the installation package of your version of SMF. Then, try to log in again.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 12:44:39 PM
Here is the log bits he sent me:

   Apply Filter: Only show the error messages of this member Guest     Reverse chronological order of list August 04, 2009, 10:55:07 pm
Apply Filter: Only show the error messages of this IP address 99.20.196.122      Apply Filter: Only show the error messages of this session b67bbd7c020b82c7054f5a3fd17e1114
     Apply Filter: Only show the errors of this type Type of error: Database
Apply Filter: Only show the error messages of this URL http://www.bqinternet.com/~jpohlman/htss/index.php?action=login2
Apply Filter: Only show the errors with the same message
Database Error: Unknown column 'passwd_flood' in 'field list'
Apply Filter: Only show the errors from this file
File: /usr/home2/jpohlman/public_html/htss/Sources/LogInOut.php
Line: 226
   
Apply Filter: Only show the error messages of this member Guest    Reverse chronological order of list August 04, 2009, 10:54:59 pm
Apply Filter: Only show the error messages of this IP address 99.20.196.122      Apply Filter: Only show the error messages of this session b67bbd7c020b82c7054f5a3fd17e1114
     Apply Filter: Only show the errors of this type Type of error: Database
Apply Filter: Only show the error messages of this URL http://www.bqinternet.com/~jpohlman/htss/index.php?action=login2
Apply Filter: Only show the errors with the same message
Database Error: Unknown column 'passwd_flood' in 'field list'
Apply Filter: Only show the errors from this file
File: /usr/home2/jpohlman/public_html/htss/Sources/LogInOut.php
Line: 226
   
Apply Filter: Only show the error messages of this member Guest    Reverse chronological order of list August 04, 2009, 10:53:28 pm
Apply Filter: Only show the error messages of this IP address 99.20.196.122      Apply Filter: Only show the error messages of this session b67bbd7c020b82c7054f5a3fd17e1114
     Apply Filter: Only show the errors of this type Type of error: Database
Apply Filter: Only show the error messages of this URL http://www.bqinternet.com/~jpohlman/htss/index.php?action=login2
Apply Filter: Only show the errors with the same message
Database Error: Unknown column 'passwd_flood' in 'field list'
Apply Filter: Only show the errors from this file
File: /usr/home2/jpohlman/public_html/htss/Sources/LogInOut.php
Line: 226


I'll try what you suggested and report back.

Edit:

I replaced the file, and it still give me the same error.
Title: Re: Database Error
Post by: babjusi on August 05, 2009, 01:20:45 PM
Did you get any error during the upgrade? Did you make a backup of your db prior to the upgrade?
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 01:43:47 PM
No errors during the upgrade, and I have a backup of the DB.
Title: Re: Database Error
Post by: babjusi on August 05, 2009, 01:52:34 PM
Can you try to run this query at the phpmyadmin?

ALTER TABLE {$db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default '';


Where {$db_prefix} equals your db prefix.
Title: Re: Database Error
Post by: Norv on August 05, 2009, 01:57:43 PM
It seems your forum database misses a field, 'passwd_flood'.

In order to add it, you should try the query babjusi advised. Alternatively, if you don't have access to phpMyAdmin, but have access to FTP, you can make a .php file (name it "addcolumn.php") with this code:

<?php
include('SSI.php');

global 
$db_prefix;
$request db_query("ALTER TABLE {$db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default ' ';"
,__FILE____LINE__);

?>


and upload it to your forum folder, then run it from the browser.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 07:18:44 PM
My table is just the default smf_ prefix.

It reported back this error:

Fatal error: Call to undefined function: db_query() in /usr/home2/jpohlman/public_html/htss/addcolumn.php on line 5

I am using the code as pasted above, save for editing the smf_ in.
Title: Re: Database Error
Post by: Arantor on August 05, 2009, 07:50:39 PM
db_query doesn't work because this is a 2.0 forum.

Instead try:

<?php
include('SSI.php');

$request $smcFunc['db_query'](''"ALTER TABLE {db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default ' '"
);

?>

Title: Re: Database Error
Post by: fox0r on August 05, 2009, 08:32:16 PM
Now it tells me:

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

And I still cannot log in.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 08:41:39 PM
I tried:


<?php
include('SSI.php');

global 
$smf_;
$request $smcFunc['db_query'](''"ALTER TABLE {smf_}members
ADD passwd_flood varchar(12) NOT NULL default ' ';"
,__FILE____LINE__);

?>



And it gave me:
An Error Has Occurred!
Hacking attempt...
Back

I had to laugh a little.
Title: Re: Database Error
Post by: Arantor on August 05, 2009, 09:06:33 PM
That was the wrong code to use. I didn't want you to change the db_prefix entry since 2.0 will do that itself quite happily without you changing anything.

The reason for the hacking attempt is because there is a ; in query.

Please try this exact code without any alterations:

<?php
include('SSI.php');

$request $smcFunc['db_query'](''"ALTER TABLE {db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default ' ' "
,__FILE____LINE__);

?>

Title: Re: Database Error
Post by: fox0r on August 05, 2009, 09:12:09 PM
Alright.  Done.  No errors from the addcolumn.php this time, but I'm still getting the same error when I try to log in.

I had the other admin on the board paste me the most recent error from the log --

http://www.bqinternet.com/~jpohlman/htss/index.php?action=login2


Database Error: Unknown column 'passwd_flood' in 'field list'


File: /usr/home2/jpohlman/public_html/htss/Sources/LogInOut.php
Line: 226
Title: Re: Database Error
Post by: Arantor on August 05, 2009, 09:14:22 PM
Agh, I really should not just edit 1.1 queries.


<?php
include('SSI.php');

$request $smcFunc['db_query'](''"ALTER TABLE {db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default ' ' "
);

?>


Though if you got no errors it may have already done it, not sure.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 09:16:13 PM
Quote from: Arantor on August 05, 2009, 09:14:22 PM
Agh, I really should not just edit 1.1 queries.


<?php
include('SSI.php');

$request $smcFunc['db_query'](''"ALTER TABLE {db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default ' ' "
);

?>


Though if you got no errors it may have already done it, not sure.

That worked.  Thanks so much!  <3
Title: Re: Database Error
Post by: Arantor on August 05, 2009, 09:19:00 PM
Excellent! Should I mark the topic solved now?
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 09:20:58 PM
Now the two mods I have installed aren't working lol.

I swear if it isn't one thing, it's another.

I figured I would just uninstall and reinstall them.. but when I click on uninstall it gives me a bunch of parse errors. :(
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 09:32:00 PM
Nothing in the logs.. I don't know what I would of done that made the mods stop working.  They worked before I logged out and couldn't log back in again, so I really have no clue.
Title: Re: Database Error
Post by: Arantor on August 05, 2009, 09:33:55 PM
Have you installed any other mods since then? Changed theme?

Normally it's best to uninstall in the reverse order of installing - last first.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 09:56:15 PM
Nope.  I didn't change anything at all other than what I was told to do here.  Everything worked great before I logged out.  I only have the two mods installed, and both give me parse errors when I go to uninstall them.
Title: Re: Database Error
Post by: Arantor on August 05, 2009, 09:57:27 PM
Well, the code between 2.0b3 and 2.0RC1.2 is quite different, unfortunately.

Which mods were they? You may be able to do the removal manually.
Title: Re: Database Error
Post by: fox0r on August 05, 2009, 10:00:07 PM
These were installed fresh when I installed the forum, which is why it doesn't make sense why it magically stopped working.

I did a fresh forum install, then installed the mods, then logged out to check one of them, and couldn't get back in, basically.

They are:
Hide Tag 2.3.5
Dice Roller BBcode 1.0

I had logged out to check the hide tag, to make sure it was functioning.
Title: Re: Database Error
Post by: babjusi on August 06, 2009, 10:34:57 AM
Quote from: Arantor on August 05, 2009, 07:50:39 PM
db_query doesn't work because this is a 2.0 forum.

Instead try:

<?php
include('SSI.php');

$request $smcFunc['db_query'](''"ALTER TABLE {db_prefix}members
ADD passwd_flood varchar(12) NOT NULL default ' '"
);

?>



Ah, but of course. I pressumed it was a 1.1. serie. Thanks for correcting it Arantor :)
Title: Re: Database Error
Post by: Arantor on August 06, 2009, 10:38:45 AM
Well, I don't know about the hide tag, but I can tell you that the Dice Roller should be compatible with both 2.0b3 and 2.0RC1.2 even though when I added the mod I couldn't select 2.0b3.

Dice Roller doesn't do any DB edits at all, it's all in the source.
Title: Re: Database Error
Post by: fox0r on August 06, 2009, 12:42:01 PM
It's really weird that it just... stopped working.  The only other thing I changed was turning off attachments, which I've since turned back on.

Neither of these mods were installed on 2.03b, just 2.1RC1.2.

It also makes no sense why updating the DB would suddenly give me a ton of parse errors for uninstall.  I'm going to rename the packages and upload them again to see if it does on install -- They both installed just fine with the installer and no errors before.
Title: Re: Database Error
Post by: fox0r on August 06, 2009, 12:43:31 PM
Oh, I just remembered, I ran the auto-fix errors thing in the admit panel.  Maybe that broke it.
Title: Re: Database Error
Post by: fox0r on August 06, 2009, 02:25:47 PM
I just checked the Subs.php file to see if the code was still in it, and it is not.

So I went ahead and reinstalled the mod, and nadda, it didn't even edit the file.  It all tested okay, though, but it made no modifications to the subs.php file.

The file and directory are both CMHOD to 777.
Title: Re: Database Error
Post by: Arantor on August 06, 2009, 02:30:37 PM
Autofix again shouldn't break Dice Roller; Dice Roller makes NO database edits anywhere in SMF.

If it didn't edit the file that suggests there is a problem. So what do you get on the main Browse Packages screen, does it say it's installed?
Title: Re: Database Error
Post by: fox0r on August 06, 2009, 02:39:23 PM
I got it to work.  My packages/temp directory decided to disappear.  It seems that it is disappearing after every mod install now, so I have to go back into my FTP and recreate it.  Not a big deal, but a PITA none the less.
Title: Re: Database Error
Post by: Norv on August 06, 2009, 02:43:12 PM
SMF package manager deletes it, as it is supposed to be a temporary folder. Then again, it should be able to create it also. Perhaps if you make sure ./Packages has all permissions, it will manage to also create it itself, thus saving you this work?
Title: Re: Database Error
Post by: babjusi on August 06, 2009, 03:53:39 PM
You can use this mod as well to prevent it from deletion.

http://custom.simplemachines.org/mods/index.php?mod=724
Title: Re: Database Error
Post by: fox0r on August 06, 2009, 04:02:30 PM
Quote from: Norv on August 06, 2009, 02:43:12 PM
SMF package manager deletes it, as it is supposed to be a temporary folder. Then again, it should be able to create it also. Perhaps if you make sure ./Packages has all permissions, it will manage to also create it itself, thus saving you this work?

It's 777.

Quote from: babjusi on August 06, 2009, 03:53:39 PM
You can use this mod as well to prevent it from deletion.

http://custom.simplemachines.org/mods/index.php?mod=724

I'll give it a shot. :)
Title: Re: Database Error
Post by: babjusi on August 06, 2009, 04:08:01 PM
Let us know how it will go.
Title: Re: Database Error
Post by: fox0r on August 06, 2009, 05:46:34 PM
The mod fixed me up!

Thanks all you guys for all of your help. <3
Title: Re: Database Error
Post by: babjusi on August 07, 2009, 06:13:53 AM
Glad to hear it.
Title: Re: Database Error
Post by: Arantor on August 07, 2009, 06:15:06 AM
Excellent to hear. I'll mark the topic solved - but if you have any more problems please do come back.