dongxia2068 2013-07-23 07:43
浏览 139
已采纳

未初始化的字符串偏移量:0,为什么?

<< Error message >>
Severity: Notice
Message: Uninitialized string offset: 0
Filename: controllers
Line Number: 192

This is the error message i encountered. and below are the controller and model files.

// controller file
    $user = $this->user_model->getByMail(array('total_mail' => $mail_auth));

    if($user = '') 
    {
        $this->load->helper('url');
        redirect('/');
    }
    else if($this->encrypt->decode($user['password']) == $password_auth) // line 192
    {
        if($user['verified'] == 'N')
        {
            $this->session->set_flashdata('message', 'Wront inputs.');
            $this->load->helper('url');
            redirect('/');
        }
    }
    else
    {
        $this->session->set_flashdata('message', 'Wrong inputs');
        $this->load->helper('url');
        redirect('/');
    }

}
    // model file
function getByMail($option)
{
    $basic_result = $this->db->get_where('ndd_user', array('total_mail' => sanitizeMySQL($option['total_mail'])));
    if ( $basic_result->num_rows() > 0 )
    {
        $result = $basic_result->row_array();
        return $result;
    }
    else
    {
        return '';
    }
}

In the model file there is a getByEmail function which outputs the array of query results. However It makes error. How can I do?

Thanks in advance :)

  • 写回答

2条回答 默认 最新

  • duanpang2751 2013-07-23 07:50
    关注

    You assigning if($user = '')

    at least it must be

    if($user == '') 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)