Log in

View Full Version : Question about description


Greenwoodi
02-13-2008, 10:13 AM
Kind all time of day, the guru vBullein's! help to adapt this code
http://www.vbulletin.com/forum/showthread.php?t=103536

in 3.6.8, tried through a plug-in global_start and through parse_templates, but, mistakes fell down.

Thanks!

Opserty
02-13-2008, 01:15 PM
Try this in global_start it should work I think:


if (THIS_SCRIPT == 'showthread')
{
$thread_description = $db->query_first("SELECT pagetext
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadid
ORDER BY postid
ASC
LIMIT 1");

$thread_description['pagetext'] = htmlspecialchars_uni($thread_description['pagetext']);
}

Bearing in mind your running an extra query on every showthread page.

Greenwoodi
02-15-2008, 03:26 PM
Works, but, on mail mistakes come:
Invalid SQL:
SELECT pagetext
FROM post
WHERE threadid =
ORDER BY postid
ASC
LIMIT 1;

Error MySQL : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
'ORDER BY postid
ASC
LIMIT 1' at line 4
Number error : 1064
Date : Wednesday, February 13th 2008 @ 06:39:20 PM

Ideas will be?

Opserty
02-15-2008, 03:30 PM
if (THIS_SCRIPT == 'showthread')
{
if(isset($_GET['t']) && (intval($_GET['t']) != 0))
{
$thread_description = $db->query_first("SELECT pagetext FROM " . TABLE_PREFIX . "post WHERE threadid = ". intval($_GET['t']) ." ORDER BY postid ASC LIMIT 1");

$thread_description['pagetext'] = htmlspecialchars_uni($thread_description['pagetext']);
}
}