I am attempting to extract data from an external db turn into a string and show in a block, I can show it outside a block but not inside.
Outside the block class the code runs, turns the output into a global string.
global $attperc;
$attperc = sqlsrv_get_field($stmt, 0);
$attstring = '<p>Your current attendance is:</p><h1 style="text-align: center;"><strong>' . '' . $attperc . '' . '</strong></h1>';
$this->content->text = $attstring;
But it just shows as blank in the block. i have tried turning it into a function and calling the function within init() but that doesnt work also.
i am not sure what to do.
thanks.