Adding onto what joy said, here are a few more ways.
1/ Set and unset the object within the function itself
function summary_report()
{
//set
$db = new databaseObject; //Change the object name
$A = $db->query("SELECT Certificate_Number FROM StockCertificates WHERE ShareholderID = $currentID ORDER BY Certificate_Creation_Date DESC");
//unset
unset($db);
}
2/ Set it like you currently have and give the function the object during the function call. (looks a little more complicated, but its not.)
$db = new databaseObject; //Change the object name
function summary_report($db_object)
{
$A = $db_object->query("SELECT Certificate_Number FROM StockCertificates WHERE ShareholderID = $currentID ORDER BY Certificate_Creation_Date DESC");
}
//then call the function like this
summary_report($db);
Hope this helps