31 lines
1.2 KiB
PHP
31 lines
1.2 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
class File extends CI_Model{
|
|
/*
|
|
* get rows from the files table
|
|
*/
|
|
function getRows($params = array()){
|
|
$this->db->select('*');
|
|
$this->db->from('data_siswa');
|
|
$this->db->where('no_pendaftaran','102223001');
|
|
$this->db->order_by('no_pendaftaran','desc');
|
|
if(array_key_exists('no_pendaftaran',$params) && !empty($params['no_pendaftaran'])){
|
|
$this->db->where('no_pendaftaran',$params['no_pendaftaran']);
|
|
//get records
|
|
$query = $this->db->get();
|
|
$result = ($query->num_rows() > 0)?$query->row_array():FALSE;
|
|
}else{
|
|
//set start and limit
|
|
if(array_key_exists("start",$params) && array_key_exists("limit",$params)){
|
|
$this->db->limit($params['limit'],$params['start']);
|
|
}elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)){
|
|
$this->db->limit($params['limit']);
|
|
}
|
|
//get records
|
|
$query = $this->db->get();
|
|
$result = ($query->num_rows() > 0)?$query->result_array():FALSE;
|
|
}
|
|
//return fetched data
|
|
return $result;
|
|
}
|
|
|
|
} |