I have a number of similar ( but not identical ) sql statements. The parameter types vary for each call and so I want to pass these as variables. Something like this:
$stmt->bind_param( $typeString, $parameter1, $parameter1 );
Where $typeString can be set to 'ss' or 'is' or 'ds'.
I get the error Number of elements in type definition string doesn't match number of bind variables.
I have tried (for instance)
$typeString = "is";
$typeString = "\'".$typeString."\'";
$stmt->bind_param( $typeString, $parameter1, $parameter1 );
And
$typeString = "is";
$stmt->bind_param( $typeString, $parameter1, $parameter1 );
But still get an error.
Is it possible to set this with a variable?
$parameter1twice.sfor param typ.