News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Database Error: Unknown column 'a.file_hash' in 'field list'

Started by Kevin Cinnamon, March 08, 2010, 09:45:31 AM

Previous topic - Next topic

Kevin Cinnamon

Hey All,

I need some help. I upgraded my SMF last night and I'm getting some errors. I'm hoping someone can help. BTW I am totally new at this.

Thanks in advance!

Kevin Cinnamon

QuoteDatabase Error: Unknown column 'a.file_hash' in 'field list'File: d:/hshome/............/...........com/forum/Sources/Display.php
Line: 949

Quote929:    if (!empty($messages))
930:    {
931:       // Fetch attachments.
932:       if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments'))
933:       {
934:          $request = $smcFunc['db_query']('', '
935:             SELECT
936:                a.id [nofollow]_attach, a.id [nofollow]_folder, a.id [nofollow]_msg, a.filename, a.file_hash, IFNULL(a.size, 0) AS filesize, a.downloads, a.approved,
937:                a.width, a.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ',
938:                IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
939:             FROM {db_prefix}attachments AS a' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
940:                LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id [nofollow]_thumb)') . '
941:             WHERE a.id [nofollow]_msg IN ({array_int:message_list})
942:                AND a.attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
943:                AND a.approved = {int:is_approved}'),
944:             array(
945:                'message_list' => $messages,
946:                'attachment_type' => 0,
947:                'is_approved' => 1,
948:             )
==>949:          );
950:          $temp = array();
951:          while ($row = $smcFunc['db_fetch_assoc']($request))
952:          {
953:             $temp[$row['id_attach']] = $row;
954: 
955:             if (!isset($attachments[$row['id_msg']]))
956:                $attachments[$row['id_msg']] = array();
957:          }
958:          $smcFunc['db_free_result']($request);
959: 
960:          // This is better than sorting it with the query...
961:          ksort($temp);
962: 
963:          foreach ($temp as $row)
964:             $attachments[$row['id_msg']][] = $row;
965:       }
966: 
967:       // What?  It's not like it *couldn't* be only guests in this topic...
968:       if (!empty($posters))
969:          loadMemberData($posters);


Arantor

Upgraded from what version to what version? What upgrade package did you use?

Kevin Cinnamon


Arantor

And did you use the upgrade.php to modify your database?

Norv

Did you run upgrade.php?
If not, please run it (and even if yes, please re-run it).

Upgrading SMF
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

Hey Guys,

I just re-ran the upgrade.php and I'm still getting the same errors.


Norv

Please, try running the attached file. (upload it in your SMF folder and run it from the browser)
It shouldn't say anything, but after running it, the error should be solved.

ETA: please use http://your_site/updateDatabase.php , with "D", too.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

When I run that file I get this...

Database Error
No database selected
File: d:\hshome\....................\...................com\forum\updateDatabase.php
Line: 23

Norv

Can you please tell, did you upload all files from a RC2 upgrade package to your SMF folder? Did you do this with Sources folder, Themes folder, etc, from the large upgrade package?
It might be worth trying to re-upload files, just to be sure. Note that sometimes FTP clients might drop files, and they don't necessarily tell so very clearly.

Also: did you have (do you still have) in your SMF directory not only upgrade.php but also 3 sql files named "upgrade"-something.sql?

ETA: ah. I see the "No database selected" error too. Please do make sure about the second part of the post (about upgrade sql files), though the first wouldn't hurt either to make sure it's okay, just in case.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

Quote from: Norv on March 08, 2010, 10:36:52 AM
Also: did you have (do you still have) in your SMF directory not only upgrade.php but also 3 sql files named "upgrade"-something.sql?

Yes


& I will reupload everything and redo. It will take me a bit of time to upload but I'll let you know when it's done.

Norv

To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

I have reuploaded all of the files however 3 .htaccess files fail to upload (1. attachments\.htaccess, 2. cache\.htaccess, & 3. packages\backups\.htaccess)

I usually use SmartFTP to upload files but I have also used the WebShell file manager that the host provides and those 3 files will not upload.

Ideas?

The other files are ready to go but I think this could be the issues.... Not sure really


Norv

Please do use the last updateDatabase file, to see if it solves the initial error.

About the impossibility to upload .htaccess files, I would advice to ask your host. They are special files that specify a few settings for the web server, and they are important for security.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

Good & Bad News.....


Good News, I can now read new & old topics. Bad news I get this error when accessing the profile options.

Unknown column 'mem.pm_receive_from' in 'field list'

QuoteUnknown column 'mem.pm_receive_from' in 'field list'
File: d:\hshome\........\......com\forum\Sources\Load.php
Line: 998

Quote978:    {
979:       $select_columns = '
980:          mem.id [nofollow]_member, mem.member_name, mem.real_name, mem.email [nofollow]_address, mem.hide_email, mem.date [nofollow]_registered,
981:          mem.posts, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id [nofollow]_group';
982:       $select_tables = '';
983:    }
984:    else
985:       trigger_error('loadMemberData(): Invalid member data set \'' . $set . '\'', E_USER_WARNING);
986: 
987:    if (!empty($users))
988:    {
989:       // Load the member's data.
990:       $request = $smcFunc['db_query']('', '
991:          SELECT' . $select_columns . '
992:          FROM {db_prefix}members AS mem' . $select_tables . '
993:          WHERE mem.' . ($is_name ? 'member_name' : 'id_member') . (count($users) == 1 ? ' = {' . ($is_name ? 'string' : 'int') . ':users}' : ' IN ({' . ($is_name ? 'array_string' : 'array_int') . ':users})'),
994:          array(
995:             'blank_string' => '',
996:             'users' => count($users) == 1 ? current($users) : $users,
997:          )
==>998:       );
999:       $new_loaded_ids = array();
1000:       while ($row = $smcFunc['db_fetch_assoc']($request))
1001:       {
1002:          $new_loaded_ids[] = $row['id_member'];
1003:          $loaded_ids[] = $row['id_member'];
1004:          $row['options'] = array();
1005:          $user_profile[$row['id_member']] = $row;
1006:       }
1007:       $smcFunc['db_free_result']($request);
1008:    }
1009: 
1010:    if (!empty($new_loaded_ids) && $set !== 'minimal')
1011:    {
1012:       $request = $smcFunc['db_query']('', '
1013:          SELECT *
1014:          FROM {db_prefix}themes
1015:          WHERE id_member' . (count($new_loaded_ids) == 1 ? ' = {int:loaded_ids}' : ' IN ({array_int:loaded_ids})'),
1016:          array(
1017:             'loaded_ids' => count($new_loaded_ids) == 1 ? $new_loaded_ids[0] : $new_loaded_ids,
1018:


Norv

Your database did not get upgraded to RC2...

Did you notice some time spent by the upgrade script, did it at least TRY to do something, at the step "database changes"?

Also, please if you want, send me in a PM your file Settings.php from the forum directory. Please note that it contains critical (for security) settings of your forum, you shouldn't be posting it in public, and you should be careful who sees it. If you don't agree to send it, or don't feel comfortable sending it, then just DON'T.
(eventually, if you wish, you can change your password and database name in the file before sending it, but please if you want to send it to me don't mess a lot else so I can see if it's a problem with it or not).
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

PM Sent (Sorry it took me so long to get back to you, Food was calling!  ;D )


Kevin Cinnamon

Bump,

Tried sending 2 PMs to Norv but I don't think its going through Norv if you could get me a email address so I can get you the info requested.

Thanks Kevin Cinnamon

Norv

Got it, sorry for the delay. Please, do try to disable javascript in your browser, and try running the upgrade.php script again. Please make sure the other upgrade sql files are in the SMF directory when doing this. Enable 'debug', and let us know what happens.

Also: note that SMF 2.0 RC3 has been released exactly these days. Please consider grabbing actually the large upgrade package to RC3, instead, and run the upgrade just the same.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Kevin Cinnamon

Hey All,

I went to RC3 (From RC2) and everything seemed to fix itself! Thanks for all of the help and pointers and to Norv you were a big help!!!!!

See you next time!

Norv

To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Advertisement: