Array has more params than PDO prepared statement causes error

Debug

New Member
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:\[quote\] Invalid parameter number: number of bound variables does not match number of tokens\[/quote\]here is what I mean:\[code\]$data = http://stackoverflow.com/questions/3569923/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);\[/code\]Is there a way to allow this? or do have to create a different array each time?
 
Back
Top