I'm creating an abstraction for my Database class.
One method is used for calling procedures, it takes in the proc name and a variable array.
The issue is that typically with PDO you have to list the variables in the query (EXEC procName :var1, :var2, :var3) then you can bind variables to those.
I want to be able to bind variables in an array, in order, without having to list the names of the vars, or the amount of variables in the query as shown in parenthesis above.
Here is how it is done typically:
$query = $database->prepare("EXEC procName :var1, :var2"); //I must list the amount and names of vars
$query->execute(array(":var1" => $var1, ":var2" => $var2);
Here is how I want it done :
$query = $database->prepare("EXEC procName"); //I don't have to list the vars here, which will allow for a dynamic amount to be passed in (very reusable)
$query->execute($arrayOfVars); //Binding an array of arguments to the proc
However, that code above will not work. Is there a way to do this?