显示每周获奖者每月一次

时间:2014-03-13 08:14:33

标签: php mysql arrays

我有一张名为数据获胜者的表格 数据库表格看起来像

   id   |   name   |  userid  |  score   |      date      |
   ------------------------------------------------------------
1   |   john   |    4     |   233    |  2014-02-02 
2   |   mary   |    5     |  1256    |  2013-02-05  
3   |   john   |    6     |   100    |  2013-03-08 
4   |   elvis  |    7     |   123    |  2013-03-04 
5   |   john   |    2     |   1234   |  2013-03-02

但是我希望显示结果像。每周都有最多4项基于最高分。我不明白该怎么做

"monthly_winners":[
    {
        "id":"2",
        "score":"1256",
        "month":"Feb"


    "weekly_winners":[
            {
                  "id":"1",
                  "score":"1256",
            },
            {
                  "id":"2",
                  "score":"233","
            },

        ],



    },
    {
        "id":"5",
        "score":"1234",
        "month":"Mar"


    "weekly_winners":[
            {
                  "id":"5",
                  "score":"1234",
            },
            {
                  "id":"4",
                  "score":"123","
            },

        ],


    }


],

我尝试了很多次,但我只能每月展示一次。

0 个答案:

没有答案