如何计算数据

时间:2017-02-23 08:57:49

标签: codeigniter count

public function index()
{
    $yek = $this->input->post("KEY");
    $cek = $this->m_user->get('KEY' => $yek)->num_rows();//line 14
    $response = array();
    if ($cek > 1)
    {
        $list = $this->m_masalah->jenis();
    }
    foreach ($list as $key ) {
        $arr = array();
        $arr['ID_MASALAH']      = $key['ID_MASALAH'];
        $arr['MASALAH']         = $key['MASALAH'];
        $arr['JENIS']           = $key['JENIS'];
        array_push($response, $arr);
    }
    echo $json_response = json_encode($response);
} 

这是我的 erorr

  

解析错误:语法错误,意外'=>'   (T_DOUBLE_ARROW),期待','或')'    E:\ xampp \ htdocs \ sengketa_dpbt \ application \ controllers \ Masalah.php 14

1 个答案:

答案 0 :(得分:-1)

=> symbol用于分配数组元素,但您没有在此处将其声明为数组。只需进行此更改:

$cek = $this->m_user->get(array('KEY' => $yek))->num_rows();