dongpu3347 2015-04-14 14:24
浏览 9

mysql哪里条件不起作用?

I have written my php code in codeigniter but when I set $limit = 1, still i get records that have seen = 1 why?? i have written a mysql query in pure sql but the problem remains ! here is my code :

function getComment($limit)
{
    while( !$this->checkFuncState('getComment') );
    $this->lockFunc('getComment');
    $grade = $this->session->userdata('grade');
    $this->db->select('*');
    $this->db->select('m_comments.id AS `ComId`');
    $this->db->select('m_comments.approved AS `Comappr`');
    $this->db->select('m_comments.content AS `ComContent`');
    $this->db->select('m_users.hid AS `UserHid`');
    $this->db->from('m_comments');
    $this->db->join('m_users','m_comments.user_id = m_users.id');
    if( $grade == "0" || $grade == "1" )
        $this->db->where("( m_comments.approved = 0 || m_comments.approved = -15 )");
    else
        $this->db->where('m_comments.approved','0');
    $this->db->where('m_comments.seen','0');
    $this->db->limit($limit);
    $q = $this->db->get();
    $this->setComsSeen($q);
    $this->unlockFunc('getComment');
    return $q;
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 vue3加ant-design-vue无法渲染出页面
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程
    • ¥20 模型在y分布之外的数据上预测能力不好如何解决
    • ¥15 processing提取音乐节奏
    • ¥15 gg加速器加速游戏时,提示不是x86架构
    • ¥15 python按要求编写程序