Everything from <!--WB_EndDetail--> comment to the end of the report template is Bottom section. It will be processed by WBSP engine and sent to client, after WBSP processes the Detail section . If it can contains DB related functions , they will not produce error, but they also will not return proper value (eg. for all $wbf functions it will return empty string). To display proper result of these functions in bottom section, place the result in a variable using $wbsetv function, and retrieve them in bottom section using $wbgetv function.
Here's an example (bottom section is marked blue)