MyBB Community Forums

Full Version: Search Attachments failed,Mysql table error?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've searched my attachments at administrator cp,but found some error here...

mySQL error: 1146
Table 'gbb_pub.threads' doesn't exist
Query: SELECT a.*, p.tid, p.fid, t.subject, f.name, u.uid, u.username FROM mybb_attachments a LEFT JOIN mybb_posts p ON (p.pid=a.pid) LEFT JOIN threads t ON (t.tid=p.tid) LEFT JOIN forums f ON (p.fid=f.fid) LEFT JOIN users u ON (p.uid=u.uid) ORDER BY a.filename

why happen this error?I've no idea,please help me to fix that...
the part of attachments.php:

	$query = $db->query("SELECT a.*, p.tid, p.fid, t.subject, f.name, u.uid, u.username FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=a.pid) LEFT JOIN threads t ON (t.tid=p.tid) LEFT JOIN forums f ON (p.fid=f.fid) LEFT JOIN users u ON (p.uid=u.uid) $sql ORDER BY a.filename");
	$num_results = $db->num_rows($query);
I've fixed them myself...
change the code to
$query = $db->query("SELECT a.*, p.tid, p.fid, t.subject, f.name, u.uid, u.username FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=a.pid) LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."forums f ON (p.fid=f.fid) LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid) $sql ORDER BY a.filename");
$num_results = $db->num_rows($query);