This should be so simple and I seem to get this every time.
I am trying to execute a query at global_start (or anywhere that's available to the header template). I know the query works as in the code below I echo out the result and it works.
What I can't do, is get the result output into the header template!
I know about registering variables, I've had that work before but once again despite numerous permutations this simply won't work.
I have even now tried using a non-existent template hook and then added that template hook into the header template - a trick I have used before to avoid the registering nonsense - but STILL it won't output.
Having tried about 436 different combinations of code, I'm now at a loss...can anyone tell me where I am going wrong?
I can echo $template_hook['status'] and it outputs correctly, but putting {vb:raw template_hook.status} into the template does nothing.
Code:
$userid = $vbulletin->userinfo['userid'];
$sql2 = "SELECT *
FROM `dbtech_status_statuslog`
ORDER BY `dbtech_status_statuslog`.`statuslogid` DESC
LIMIT 1";
$query = mysql_query($sql2);
if(!$query)
{
echo 'Query failed';
}
else
{
echo 'Query Ok';
}
$data = mysql_fetch_assoc($query);
$template_hook['status'] = $data['status'];
echo $template_hook['status'];