xthreads error
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #1
xthreads error
got an error while trying to browse the restricted forums

Code:
1
2
3
4
5
6
Site has experienced an internal SQL error and cannot continue.

SQL Error:
    1054 - Unknown column 'tfd.desc' in 'field list'
Query:
    SELECT t.*, tfd.`desc` AS `xthreads_desc`, t.username AS threadusername, u.username, u.avatar FROM nstdb_threads t LEFT JOIN nstdb_users u ON (u.uid = t.uid) WHERE t.fid IN (148,149,163) AND t.tid IN (0,'345','324','256','108') AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, 10


checked the phpmyadmin for the field list table. but didnt find any.

01-06-2011 02:12 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #2
RE: xthreads error
You need to do a left join to the threadfields.

Try this.............

SQL Code
SELECT t.*, tfd.desc AS xthreadsdesc, t.username AS threadusername, u.username, u.avatar 
FROM ".TABLE_PREFIX."threads t 
LEFT JOIN ".TABLE_PREFIX."threadfields tfd ON (tfd.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid) 
WHERE t.fid IN (148,149,163) AND t.tid IN (0,'345','324','256','108') AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC




if it doesnt like the double quotes on the table_prefix try single ones, like this:

Code:
'.TABLE_PREFIX.'



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 01-06-2011 03:01 PM by leefish.)
01-06-2011 02:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #3
RE: xthreads error
Ok lee. I will try to run this in the phpmyadmin. But, i had a doubt. As this query is called from a file which will be same as

Code:
1
2
3
4
5
6
Site has experienced an internal SQL error and cannot continue.

SQL Error:
    1054 - Unknown column 'tfd.desc' in 'field list'
Query:
    SELECT t.*, tfd.`desc` AS `xthreads_desc`, t.username AS threadusername, u.username, u.avatar FROM nstdb_threads t LEFT JOIN nstdb_users u ON (u.uid = t.uid) WHERE t.fid IN (148,149,163) AND t.tid IN (0,'345','324','256','108') AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, 10

unless we change the query to the one you suggested. If i run your join table query in phpmyadmin, will solves the problem? As i'm thinking, the query in the file tries to perform the same query above.

(This post was last modified: 01-07-2011 03:56 AM by 1master1.)
01-07-2011 03:50 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: xthreads error
The same issue like this?
http://mybbhacks.zingaburga.com/showthread.php?tid=588

01-07-2011 05:56 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: xthreads error
Yea RateU, I knew he had posted this before. 1master1, the problem here is that you are shrouding this whole query in mystery. We do not really know what you are trying to achieve, where you want to use it etc.

In this case, trying to help you is hard. If you put that query in a function (either in a plugin file or whatever file you are trying to load it from) it will do something. Whether it will do what you want - I have no idea.

What I DO know is, if you want to call a field from the threadfields table when your select is on the threads table you have to JOIN to the threadfields table in your query. Thats for sure.

Also, in phpmyadmin, you will see a table called threadfields. Scroll to the bottom of the table and click check all. Then the browse icon. Then you will see the table layout and you will see that there is indeed a column in threadfields called desc. There is in mine anyway.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 01-07-2011 06:51 AM by leefish.)
01-07-2011 06:35 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #6
RE: xthreads error
yeah, there are 2 threadfileds - desc(thread description) & timg(thread image).

the only thing i did is, i called the tdesc field not only in forum view but also in the thread title of thread view also.


thread name - thread desc
-------------------------------
author   |     message
postbit   |
-------------------------------
quick reply.
01-07-2011 07:28 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #7
RE: xthreads error
(01-07-2011 07:28 AM)1master1 Wrote:  the only thing i did is, i called the tdesc field not only in forum view but also in the thread title of thread view also.


thread name - thread desc
-------------------------------
author   |     message
postbit   |
-------------------------------
quick reply.

You can put the {$GLOBALS['threadfields']['desc']} directly in your showthread template if you want to display it in showthread?

01-07-2011 08:23 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: xthreads error
Ok, lets get this clear. In which table are these columns?
Do you understand what you are putting in that query?

Lets break it down:

Code:
SELECT t.*, tfd.desc AS xthreadsdesc, t.username AS threadusername, u.username, u.avatar 
FROM ".TABLE_PREFIX."threads t 


The above code says, we are going to take ALL the columns from a table with a shorthand reference of t and and rename the column t.username AS threadusername and a field called desc from a table with a shorthand reference of tfd and two columns from a table with a shorthand reference of u

The next line says that table prefix threads is the table referred to with the letter t. At this point you have identified any field with the t. but the query does not know what you mean by u or tfd. So, we tell it - we say as below:

Code:
LEFT JOIN ".TABLE_PREFIX."threadfields tfd ON (tfd.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid) 


Now it knows that the tfd shorthand refers to the threadfields table and the u shorthand refers to the users table. But thats not enough - you need to have a field in BOTH tables that are the same - so we say that the field in u.uid is the same value as the field in t.uid. Same with the tfd. We always compare it to the t. as this is the table you have selected from.

Does this help?



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 01-07-2011 09:30 AM by leefish.)
01-07-2011 08:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #9
RE: xthreads error
Well, i'm in position to figure out the join table problem if i know where that query is being called. But, when it shows error while accessing or when it saves that error in error log, i see that it displays only the query information and no details of the location, and i'm sure it is not caused because of the default xthread files. There is another plugin file or core file while is already modified with the xthreads is causing the error.

Can't find where the error is being generated. But i had seen that when a new user registers and when he gets autologged in and when he browses the forums, the error is generated. I had set the forum permissions (can see forum list but not access) for the awaiting activation members.
01-11-2011 04:37 PM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #10
RE: xthreads error
found that the xthread custom field permissions are not synchronizing withe the default mybb permissions.
i had made some forums only viewable for awaiting activation members and they cannot see the threads inside it and had the thread description field installed.
now when they click on the forum name, it is giving the error which is in first post. i tried custom setting the permissions of the xthread field. but didnt worked.
01-12-2011 07:32 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: