I'm trying to construct a single query that will update multiple rows in a table, using the method described here: Multiple Updates in MySQL
Essentially, I'm using the INSERT ... ON DUPLICATE KEY UPDATE method, using a query like 
INSERT INTO table1 
(id, val1, val2) 
VALUES 
(0, 5, 5)...<etc.> 
ON DUPLICATE KEY 
    UPDATE id=VALUES(id), val1=VALUES(val1), val2=VALUES(val2)
The problem is that the id column is referenced as a foreign key from a different table, so when I try to execute this query, I get a Cannot delete or update a parent row: a foreign key constraint fails error.
Is there a way to make the INSERT DUPLICATE KEY UPDATE method work with this foreign key constraint (I'd rather not disable the constraint, even temporarily), or am I stuck sending multiple queries to my database?
 
    