xthreads error
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

« Next Oldest | Next Newest »

Messages In This Thread
xthreads error - 1master1 - 01-06-2011, 02:12 PM
RE: xthreads error - leefish - 01-06-2011, 02:42 PM
RE: xthreads error - 1master1 - 01-07-2011, 03:50 AM
RE: xthreads error - RateU - 01-07-2011, 05:56 AM
RE: xthreads error - leefish - 01-07-2011, 06:35 AM
RE: xthreads error - 1master1 - 01-07-2011, 07:28 AM
RE: xthreads error - RateU - 01-07-2011, 08:23 AM
RE: xthreads error - leefish - 01-07-2011 08:28 AM
RE: xthreads error - 1master1 - 01-11-2011, 04:37 PM
RE: xthreads error - 1master1 - 01-12-2011, 07:32 PM
RE: xthreads error - RateU - 01-13-2011, 01:56 AM
RE: xthreads error - 1master1 - 01-13-2011, 05:09 AM
RE: xthreads error - RateU - 01-13-2011, 05:23 AM
RE: xthreads error - 1master1 - 01-13-2011, 05:26 AM
RE: xthreads error - RateU - 01-13-2011, 05:46 AM
RE: xthreads error - ZiNgA BuRgA - 01-13-2011, 09:29 AM
RE: xthreads error - 1master1 - 01-13-2011, 05:09 PM
RE: xthreads error - ZiNgA BuRgA - 01-13-2011, 07:20 PM
RE: xthreads error - 1master1 - 01-14-2011, 09:15 PM
RE: xthreads error - ZiNgA BuRgA - 01-15-2011, 09:47 AM
RE: xthreads error - 1master1 - 01-15-2011, 06:10 PM
RE: xthreads error - RateU - 01-16-2011, 02:15 AM
RE: xthreads error - 1master1 - 01-16-2011, 03:56 AM
RE: xthreads error - 1master1 - 02-16-2011, 09:10 PM
RE: xthreads error - RateU - 02-17-2011, 01:54 AM
RE: xthreads error - 1master1 - 02-17-2011, 04:35 PM
RE: xthreads error - RateU - 02-18-2011, 03:26 AM
RE: xthreads error - 1master1 - 02-18-2011, 05:02 AM
RE: xthreads error - RateU - 02-18-2011, 05:40 AM
RE: xthreads error - 1master1 - 02-18-2011, 05:41 PM

 Standard Tools
Forum Jump: