MyBB Hacks

Full Version: Query to get threads ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
$thread-trend to get Subject (limited by 55 chars)
and this subject together work with another template call (portal_latest_trend) like this

Code:
<div>
<a href="{$mybb->settings['bburl']}/thread-{$thread-trend['tid']}.html">{$thread-trend['subject']}</a>
</div>


So I have full thread link to display on my custom page.
But, as you said there is no Join.
Could you please help, which code should be add? Smile

???
A '-' character is either a subtraction operator, or a negation.  You cannot include them in variable names.  Did you mean the underscore (_) character instead.

"$thread-trend[...]" is an invalid PHP expression.  It means "get the $thread variable, and subtract trend[...] from it.  But trend isn't prefixed with a $, so it can't be a variable, it must be a fixed (constant) expression.  But constants can't be arrays, therefore, it's invalid syntax"
With the above expression, you should get something like:

Code:
Parse error: syntax error, unexpected '[', expecting ',' or ';' in ... on line ...



Adapt the following to your needs.

PHP Code:
$query = $db->query(' SELECT t.subject, p.prefix from '.TABLE_PREFIX.'threads t LEFT JOIN '.TABLE_PREFIX.'threadprefixes p ON t.prefix=p.pid ...');

Pages: 1 2
Reference URL's