If Have to execute several queries. Some of the parameters overlap, some do not.
I wanted to create one array containing the data for all the params for all the queries.
I figured if the array contains values that the prepared statement does not, it would ignore them but its giving me this error:
Invalid parameter number: number of bound variables does not match number of tokens
here is what I mean:
$data = array( 'a' => $a, 'b' => $b, 'c' => $c, 'd' => $d);
$data['e'] = "e";
$STH = $this->PDO->prepare("INSERT INTO table1 ( fieldA, fieldB, fieldE ) VALUES (:a, :b, :e )");
$STH->execute($data);
$data['f'] = "f";
$STH = $this->PDO->prepare("INSERT INTO table2 ( fieldA, fieldD, fieldF ) VALUES (:a, :d, :f )");
$STH->execute($data);
Is there a way to allow this? or do have to create a different array each time?