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条)

报告相同问题?

悬赏问题

  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历