Hi. I am having a trouble to get some results from my secondary database table named "Reg".
I am trying to put some query in events "Welcome page->Before display", but getting error all the time.
I have some global variables to fill initialy. Here is my code in the above event:
$myquery = "select RegType from Reg";
$rs2 = DB::Query($myquery);
$data2=$rs2->fetchAssoc();
if($data2)
{
$TypeReg = implode(" ",$data2);
if ($TypeReg=='1')
{
$_SESSION['var_reg']='1';
}
else
{
$_SESSION['var_reg']='0';
}
}
else
{
$_SESSION['var_reg']='0';
}
I suppose I should change connection to secondary database, but I have tried with:
DB::SetConnection("Reg"); = doesn't work
I appreciate any help!