doulang6695
2019-05-10 05:23
浏览 16
已采纳

如何使用之间将简单的SQL查询转换为CodeIgniter?

Please help me, I want to convert a simple SQL statement to Codeigniter

date($fromDate) BETWEEN vehicle_register.start_dt AND vehicle_register.end_dt

图片转代码服务由CSDN问答提供 功能建议

请帮助我,我想将一个简单的SQL语句转换为Codeigniter

  date($ fromDate)BETWEEN vehicle_register.start_dt AND vehicle_register.end_dt 
   
 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dpde7365 2019-05-10 05:29
    已采纳

    Try this with Method chaining,

    $this->db->select('*');
    $this->db->from('yourTableName');
    $this->db->where('date('.$fromDate.') >=', 'vehicle_register.start_dt');
    // >= will get conditional date too so please keep it as your reqirement
    $this->db->where('date('.$fromDate.') <=', 'vehicle_register.end_dt');
    $query= $this->db->get();
    if($query->num_rows() > 0){
      //return $query->result();//according to your need
    }else{
      //return array();//according to your need
    }
    
    点赞 评论

相关推荐 更多相似问题