The problem I'm having is with a strategy browser game which has 7 types of values. The problems are as follows:
- I got 7 different values in
$_POST, from index unit_1 to index unit_7 included. These 7 values are INTEGERS between 0 and 20 and aren't static. They can at each call of the page. They represent the number of units sent. - I got 7 lines in a table that does not follow the same schema :
"nameUnit" = "Soldier"&&nbUnit = "0","nameUnit" = "Mage"&&nbUnit = "5", etc.. - I need to do an update on the number of units in 1 request, but I don't know how to do this.
Example of what I want to do :
UPDATE x SET nbUnit = $_POST['u1'] WHERE nameUnit = "Soldier", nbUnit = $_POST['u2'] WHERE nameUnit = "Mage" [...]
Is it possible to do this that way and can it be done in a single query?
SETclause) are the same, you can use the clauseOR. If the values are different, you have the create one update for each statement.