Here are some global declarations prior to any function dec in an include file... //------- //Declare //------- $prm_from_dt=""; $prm_from_dttme=""; $prm_to_dt=""; $prm_to_dttme=""; $prm_asat_dt=""; $prm_asat_dttme=""; $prm_year=""; $prm_month=""; function DayOf($dte) ...and here is some code making use of that \ explode($GLOBALS) $query=" SELECT ". " p.ProductKey, p.ProductName, t.trantype, t.tranmodifier, t.trantaxrate,". " SUM(t.TranQty) AS sumQty, ". " SUM(t.TranTotalPrice) AS sumPrice, ". " SUM(t.TranTotalCost) AS sumCost ". " FROM Transactions t, Orders o, Products p ". " WHERE t.ProductKey = p.ProductKey ". " and t.orderkey = o.orderkey ". " and o.OrderDteTme BETWEEN #".$prm_from_dttme."# AND #".$prm_to_dttme."# ". " GROUP BY p.ProductKey, p.ProductName, t.trantype, t.tranmodifier, t.trantaxrate ". " ORDER by p.ProductKey ";