如果我的列 player_a_id 为空,我想更新它,否则更新 player_b_id。
这是我的桌子: 房间
+---------+---------+-------------+-------------+-------------+---------+
| room_id | room_no | room_name | player_a_id | player_b_id | turn_of |
+---------+---------+-------------+-------------+-------------+---------+
| 1 | 1 | blah | 1 | 3 | 0 |
| 2 | 5 | second room | 1 | 3 | 0 |
| 3 | 3 | 3rd room | 4 | 5 | 0 |
| 4 | 4 | 4th room | 6 | 7 | 0 |
+---------+---------+-------------+-------------+-------------+---------+
基本上我的目标很简单,当玩家加入房间时,它会更新 player_a_id,否则如果 player_a_id 已被占用,则更新 player_b_id。