MyBB Community Forums

Full Version: [F] Attachment search: SQL error [C-Michael83]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you search for an attachment in the Admin-CP you get an SQL error:
Quote:MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1054 - Unknown column 'a.mimetype' in 'where clause'
Query:
SELECT COUNT(a.aid) AS num_results FROM mybb_attachments a LEFT JOIN mybb_posts p ON (p.pid=a.pid) WHERE 1=1 AND a.mimetype LIKE '%text%'
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Changeset #4249

This fix is incomplete. You can enter whatever you want into the field "File type contains" of the search form. You'll always get all attachments shown in the results list.

Fix: Find in the file admin/modules/forum/attachments.php:
$form_container->output_row($lang->type_contains, "", $form->generate_text_box('mimetype', $mybb->input['mimetype'], array('id' => 'mimetype')), 'mimetype');
Replace with:
$form_container->output_row($lang->type_contains, "", $form->generate_text_box('filetype', $mybb->input['filetype'], array('id' => 'filetype')), 'filetype');

In line 780 in the $pagination_vars array mimetype has to be changed to filetype, too.
Corrected in the SVN - Thanks Michael