根据本月,本季度和今年筛选数据

时间:2020-03-10 11:45:14

标签: php mysql sql codeigniter

我正在使用PHP CI从数据库中过滤数据,我需要使用具有固定数据(本月,本季度,本年)的dd菜单过滤数据。 这是下拉菜单的代码

                                    <select class="form-control lb-sort leaderboard-select" name="filter">
                                        <option >Sort</option>
                                        <option value="MONTH">This Month</option>
                                        <option value="QUARTER">This Quarter</option>
                                        <option value="YEAR">This Year</option>
                                        <option>All Time</option>
                                    </select>

这里是我用来过滤数据的查询代码

    $filter = "";
            $filter_leaderboard="";
            if($_GET['filter']){
                $filter = $_GET['filter'];
            }
            if($filter === "MONTH"){
                $filter_leaderboard = "MONTH(updated_date) = MONTH(NOW())";
            }else if($filter === "QUARTER"){
                $filter_leaderboard = "QUARTER(updated_date) = QUARTER(NOW())";
      }else if($filter === "YEAR"){
                $filter_leaderboard = "YEAR(updated_date) = YEAR(NOW())";
            }

            $paramSelect = "*";
            $paramTable = " tbl_user  where ".$filter_leaderboard  ;
            $data['user'] = $this->Common_model->Common_join($paramSelect,$paramTable);

但是过滤不起作用?

您能帮我检查哪里出问题吗?

1 个答案:

答案 0 :(得分:0)

statusList = ["test1", "test2", "test3"] @client.event async def on_ready(): while True: for status in statusList: await client.change_presence(activity=discord.Activity(name=status, type=discord.ActivityType.watching)) 替换为$filter_leaderboard="",然后重试。