47
// BUILD VALUES
$count = count($matches);
for($i = 0; $i < $count; ++$i) {
$values[] = '(?)';
}
// INSERT INTO DATABASE
$q = $this->dbc->prepare("INSERT INTO hashes (hash) VALUES " . implode(', ', $values) . " ON DUPLICATE KEY UPDATE hash = hash");
$q->execute($matches);
The code above fails with the following error
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
Although when count($matches) == count($values) just before execute is called?
What is going on here?