I have a relatively simple query that is executed via db_query()->execute; For some reason this causes a PDO Error, which I assume has to do with the way drupal handles the input. Any ideas on what causes this error and how to avoid it?
db_query('
INSERT INTO {account_floodprotect} (ipaddress, soapcount, mailcount)
VALUES (:ipaddress, :soapcount, :mailcount)
ON DUPLICATE KEY UPDATE
soapcount = soapcount + :soapcount,
mailcount = mailcount + :mailcount',
array(
':ipaddress' => $ip,
':soapcount' => $soapcount,
':mailcount' => $mailcount,
))->execute();
/*
ERROR CAUSED:
PDOException: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
The table involved:
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| ipaddress | varchar(255) | NO | UNI | | |
| soapcount | int(10) unsigned | YES | | 0 | |
| mailcount | int(10) unsigned | YES | | 0 | |
| updatetime | timestamp | YES | | NULL | |
+------------+------------------+------+-----+---------+----------------+