CI_DB_active_record::limit PHP Méthode

limit() public méthode

Sets the LIMIT value
public limit ( $value, $offset = '' ) : object
Résultat object
    function limit($value, $offset = '')
    {
        $this->ar_limit = $value;
        if ($offset != '') {
            $this->ar_offset = $offset;
        }
        return $this;
    }

Usage Example

Exemple #1
0
 /**
  * 删除数据
  * @param array|string $where 条件
  * @param int $limit 删除数量限制,默认不限制
  * @return int $delete_count 删除的记录数
  */
 public function delete($where, $limit = NULL)
 {
     if (!is_null($limit) && is_numeric($limit)) {
         $this->where($where);
         if (is_numeric($limit)) {
             $this->db->limit($limit);
         }
         $this->db->delete($this->_name);
         return $this->db->affected_rows();
     }
     $this->db->delete($this->_name, $where);
     return $this->db->affected_rows();
 }
All Usage Examples Of CI_DB_active_record::limit