I am busy doing an UPDATE/INSERT request, but here is the crux:
table PLAYERS {
player_id
game_id
team_id
position
number
}
What is supposed to happen is the following:
I test if there is an entry where
player_id = '$player_id' AND game_id = '$game_id' AND team_id = '$team_id'.
If there is, then the following happens:
position = '$position' AND number = '$number'
Is there any way I can do this using just MySQL query language, without the need for PHP validation between queries?
INSERT INTO TABLE (COLUMNS) VALUES(FIELDS) UPDATE ON DUPLICATE KEY position = somevalue, number=number
1) Tries to Insert
2) If there is a record with a unique field (Primary Key, Unique Index, etc) update that field instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With