<< Error message >>
Severity: Notice
Message: Uninitialized string offset: 0
Filename: controllers
Line Number: 192
Это сообщение об ошибке, с которым я столкнулся. и ниже - файлы контроллера и модели.Неинициализированное смещение строки: 0, почему?
// 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 '';
}
}
В файле модели есть функция getByEmail, которая выводит массив результатов запроса. Однако он делает ошибку. Как я могу сделать?
Заранее спасибо :)
Не могли бы вы сказать, где находится эта строка «192»? – guessimtoolate
Я добавил сноску «// строка 192». – nextdoordoc
Моя ставка 'if ($ user = '')' - она присваивает пустое строковое значение '$ user', так что это '', когда вы проверяете, есть ли в вашем else if? Вероятно, вы имели в виду 'if ($ user == '')'. – guessimtoolate