I am moving 2 rows from a table called allCooks
to one row in a table called recipeChallenge
(cookAAA against cookBBB in a pizza challenge)
Each match already has an ID, and this is the row I want to UPDATE
I am doing the update twice, once for cookAAA and then for cookBBB
To update the matchID with cook A...(i-ve left the php variables in)
"UPDATE `recipeChallenge` AS v1,
`allCooks` AS v2
SET v1.`cookAAAID` = v2.`cookID`,
v1.`cookAAAName` = v2.`cookName`
WHERE v1.`matchID`='" .$matchID."'
AND v2.`cookID`= '" .$cookAID."'";
and then for cook B
"UPDATE `recipeChallenge` AS v1,
`allCooks` AS v2
SET v1.`cookBBBID` = v2.`cookID`,
v1.`cookBBBName` = v2.`cookName`
WHERE v1.`matchID`='" .$matchID."'
AND v2.`cookID`= '" .$cookBID."'";
The table recipeChallenge
is updating, but the second update is ALSO creating a new matchID
and row in the recipeChallenge
table. Why?