Welcome Guest, Not a member yet? Register   Sign In
Unknown column Array field list
#1

(This post was last modified: 11-03-2021, 07:39 PM by nooreen.)

Code:
*model*

class M_belajar extends CI_Model
{

function save($datasensor)
{
$this->db->insert('tbl_water_level', $datasensor);
return TRUE;
}

function river()
{

$query = $this->db->select('river_id')->from('tbl_activation')->order_by('activation_id', 'DESC')->limit('1')->get();

    return $query->row()->river_id;
}

*controller*

public function sensor(){
$this->load->model('m_belajar');


if (isset($_GET['data'])) {

$panjang = $this->input->get('data');

$river_id['river'] = $this->m_belajar->river();
print_r($river_id);


$datasensor = array('water_distance' => $panjang, 'water_time' => time(), 'river_id' => $river_id );
Reply
#2

I already got the answer. On the controller side

instead of
$river_id['river'] = $this->m_belajar->river();

i just need to code
$river_id = $this->m_belajar->river();
Reply




Theme © iAndrew 2016 - Forum software by © MyBB