Can you post your code where the shortcode involved is called as well as the complete code of your function? Please use the code
button at the top of the editor to enclose your code so that it can be read more easily.
Your code should look like this
<?php
// your code here
?>