Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 SQL Error While Filtering
cheefin Offline
Junior Member
**
Posts: 1
Joined: Jan 2020
Post: #1
SQL Error While Filtering
I am getting an SQL while filtering my threads by a custom field. I have the exact same setup on another board which is version 1.8.21 as the board im working now which is version 1.8.22. I dont know if this update has something to do with it or not.

The forum im making is a marketplace forum for online accounts. I have a field called trdfplat which holds the value for which platform the account is on (xbox, ps4, etc.). This is the SQL error im recieving.

SQL Error:
1054 - Unknown column 'tfd.trdfplat' in 'where clause'
Query:
SELECT COUNT(tid) AS threads FROM mybb_threads t WHERE fid = '36' AND (t.visible IN (1,-1,0)) AND tfd.`trdfplat` IN ("Xbox")

Any help would be great! Thank you.
01-06-2020 06:04 PM
Find all posts by this user Quote this message in a reply
Cobalt60 Offline
Junior Member
**
Posts: 6
Joined: Jan 2020
Post: #2
RE: SQL Error While Filtering
Hi,
any solution, yet? I have the same issue on 1.8.22 (using the Link Directory).
Cheers!
(This post was last modified: 01-09-2020 03:31 AM by Cobalt60.)
01-09-2020 12:37 AM
Find all posts by this user Quote this message in a reply
Cobalt60 Offline
Junior Member
**
Posts: 6
Joined: Jan 2020
Post: #3
RE: SQL Error While Filtering
Full error:

<error>
<dateline>1578505893</dateline>
<script></script>
<line>0</line>
<type>20</type>

<friendly_type>MyBB SQL Error</friendly_type>

<message>SQL Error: 1054 - Unknown column 'tfd.xtldcat' in 'where clause'
Query: SELECT COUNT(tid) AS threads FROM iioc_threads t WHERE fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  </message>

<back_trace>#0  errorHandler->log_error(20, SQL Error: 1054 - Unknown column 'tfd.xtldcat' in 'where clause'
Query: SELECT COUNT(tid) AS threads FROM iioc_threads t WHERE fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  , , 0) called at [/hp/bv/ab/cf/www/forum-url/inc/class_error.php:189]
#1  errorHandler->error(20, Array ([error_no] => 1054,[error] => Unknown column 'tfd.xtldcat' in 'where clause',[query] => SELECT COUNT(tid) AS threads FROM iioc_threads t WHERE fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  )) called at [/hp/bv/ab/cf/www/forum-url/inc/db_mysqli.php:597]
#2  DB_MySQLi->error(SELECT COUNT(tid) AS threads FROM iioc_threads t WHERE fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  ) called at [/hp/bv/ab/cf/www/forum-url/inc/db_mysqli.php:337]
#3  DB_MySQLi->query(SELECT COUNT(tid) AS threads FROM iioc_threads t WHERE fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  , 0, 0) called at [/hp/bv/ab/cf/www/forum-url/inc/plugins/xthreads.php(878) : eval()'d code:8]
#4  _objcont_3->query(SELECT COUNT(tid) AS threads FROM iioc_threads t WHERE fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  ) called at [/hp/bv/ab/cf/www/forum-url/inc/db_mysqli.php:789]
#5  DB_MySQLi->simple_select(threads t, COUNT(tid) AS threads, fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  , Array ()) called at [/hp/bv/ab/cf/www/forum-url/inc/plugins/xthreads.php(878) : eval()'d code:24]
#6  _objcont_6->simple_select(threads t, COUNT(tid) AS threads, fid = '44'  AND (t.visible IN (1,-1,0)) AND tfd.`xtldcat` IN ("Filter-word")  ) called at [/hp/bv/ab/cf/www/forum-url/forumdisplay.php:610]
</back_trace>
</error>
(This post was last modified: 01-09-2020 04:11 AM by Cobalt60.)
01-09-2020 03:47 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,340
Joined: Jan 2008
Post: #4
RE: SQL Error While Filtering
I've spent basically no time on this, but a very quick look at the code, perhaps the following change may work.

In inc/xthreads/xt_forumdhooks.php, find:

PHP Code:
$table == "threads"

replace with

PHP Code:
($table == "threads" || $table == "threads t")


Otherwise I'll try to find some time to look into this more.


My Blog
01-09-2020 02:34 PM
Find all posts by this user Quote this message in a reply
Cobalt60 Offline
Junior Member
**
Posts: 6
Joined: Jan 2020
Post: #5
RE: SQL Error While Filtering
Fantastic!

That did the job.

Thanks for the great support, ZiNgA BuRgA
01-09-2020 04:40 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,340
Joined: Jan 2008
Post: #6
RE: SQL Error While Filtering
Thanks for confirming.  I'll probably need to spend some time to see if there's other issues due to changes in newer versions of MyBB.

My Blog
01-09-2020 08:53 PM
Find all posts by this user Quote this message in a reply
dada732 Offline
Junior Member
**
Posts: 1
Joined: Feb 2020
Post: #7
RE: SQL Error While Filtering
hello

i have the same problem after testing the job portal modified  on my website

SQL Error:
1054 - Unknown column 'tfd.xtjpcat' in 'where clause'
Query:
SELECT COUNT(tid) AS threads FROM mybbq6_threads t WHERE fid = '4' AND (t.visible IN (1)) AND tfd.`xtjpcat` IN ("surencheres")

i go to the "xt_forumdhooks.php" page and see the line

$dbt = '
static $done_t = false;
if(!$done_t && ($table == "threads" || $table == "threads t") && $fields == "COUNT(tid) AS threads") {
$done_t = true;
$table = "threads t LEFT JOIN {$this->table_prefix}threadfields_data tfd ON t.tid=tfd.tid";
$fields = "COUNT(t.tid) AS threads";
$conditions = xthreads_forumdisplay_filter_fixqcond($conditions);
$options = array("limit" => 1);
}
';

what's the problem?

cordially[/i]
02-27-2020 09:11 AM
Find all posts by this user Quote this message in a reply
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #8
RE: SQL Error While Filtering
Same problem but with ZiNgA BuRgA's edit it works again.

Thank you Yipi
03-24-2020 10:09 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,349
Joined: Mar 2010
Post: #9
RE: SQL Error While Filtering
It think it is related to this change:
(01-21-2020 10:03 AM)Sama34 Wrote:  https://github.com/mybb/mybb/commit/b356...f31431d5e0

04-26-2020 03:26 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: