Now say my sql query was like: "Select * from Contact where CustID=? and Expired=?" How would I build an array and pass the into my function?
I would remove the $queryparams=array($params);
part of your code, and always pass the function an array even if it has only one elements.
$params= array($custID);
$sql = "SELECT Email from Contact WHERE VendID = ?";
try{
$emails=$db->fetchQuery($sql,$params,$conn);
mutiple
$params= array($vendID, $expired);
$sql = "Select * from Contact where CustID=? and Expired=?";
try{
$emails=$db->fetchQuery($sql,$params,$conn);
I personaly prefer the named parameter, where I can use the associative arrays:
$sql = "Select * from Contact where CustID= :custId and Expired= :expired";
$params= array(':custId'=>$custID,
':expired'=>$expired
);