我想要一张像这样的桌子(记分卡):
|ID |Name |34 |35 |36 |...
|1 |Paul |0 |0 |0 |...
...
数字是几周。所以现在我们在第35周,所以我想更新第35列。我写道:
$week = Date('W');
$sql = "UPDATE scorecard SET `'$week'` = 5 WHERE id = 1";
下周它应自动为第36栏。
甚至可能吗?显然这没有用,因为我发布了这个帖子:)
答案 0 :(得分:1)
找到答案,感谢@ Fred-ii-:
$week = Date('W');
$sql = "UPDATE scorecard SET `$week` = 5 WHERE id = 1;