MyBB Community Forums

Full Version: [F] Deleting queued attachments [C-Michael83]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I get this error when trying to delete queued attachments in
modcp.php?action=modqueue

MyBB
MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1054 - Unknown column 'p.tid' in 'on clause'
Query:
    SELECT a.pid, a.aid FROM mybb_attachments a LEFT JOIN mybb_threads t ON (t.tid=p.tid) WHERE aid IN (47,48,51,52,53,54,59,60) 

Please contact the MyBB Group for support.
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
To fix, in modcp.php, find:
$query = $db->query("
			SELECT a.pid, a.aid
			FROM  ".TABLE_PREFIX."attachments a
			LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
			WHERE aid IN (".implode(",", array_map("intval", array_keys($mybb->input['attachments'])))."){$flist}
		");

Replace with:
$query = $db->query("
			SELECT a.pid, a.aid
			FROM  ".TABLE_PREFIX."attachments a
			LEFT JOIN ".TABLE_PREFIX."posts p ON (a.pid=p.pid)
			LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
			WHERE aid IN (".implode(",", array_map("intval", array_keys($mybb->input['attachments'])))."){$tflist}
		");