Where to include a new variable?
I have built an SQL query that returns the count of a user's topics in certain forums. I want to use this as a variable, so I can use it in my postbit templates.
The problem is I don't know how to do that.
The code I THINK I should use to define the variable with this SQL query is this;
$stories = $db->query_first("
SELECT
Count(vbthread.threadid)
FROM vbthread
WHERE
(vbthread.forumid = '57' OR
vbthread.forumid = '58' OR
vbthread.forumid = '59' OR
vbthread.forumid = '60' OR
vbthread.forumid = '61' OR
vbthread.forumid = '62' OR
vbthread.forumid = '63' ) AND
vbthread.postuserid = '$post[userid]'
");
1. Is this correct?
2. Where should I use this code to define the variable and then be able to use the $stories variable inside my postbit templates?
|