Codeigniter $this->db->get_where

Тема в разделе "PHP", создана пользователем parampoparam, 20 июл 2016.

  1. parampoparam

    parampoparam

    Регистрация:
    9 янв 2016
    Сообщения:
    29
    Симпатии:
    6
    Разбираю один скрипт, и вылетает ошибка:
    A PHP Error was encountered
    Severity: Notice
    Message: Trying to get property of non-object
    Filename: controllers/Doctor.php
    Line Number: 33
    Backtrace:

    в етой строке
    $patient = $this->db->get_where('patient', array('email' => $email))->row()->name;

    целая функция

    function patient($task = "", $patient_id = "") {
    if ($this->session->userdata('doctor_login') != 1) {
    $this->session->set_userdata('last_page', current_url());
    redirect(base_url(), 'refresh');
    }

    if ($task == "create") {
    $email = $_POST['email'];
    $patient = $this->db->get_where('patient', array('email' => $email))->row()->name;
    if ($patient == null) {
    $this->crud_model->save_patient_info();
    $this->session->set_flashdata('message', get_phrase('patient_info_saved_successfuly'));
    } else {
    $this->session->set_flashdata('message', get_phrase('duplicate_email'));
    }
    redirect(base_url() . 'index.php?doctor/patient');
    }

    if ($task == "update") {
    $this->crud_model->update_patient_info($patient_id);
    $this->session->set_flashdata('message', get_phrase('patient_info_updated_successfuly'));
    redirect(base_url() . 'index.php?doctor/patient');
    }

    if ($task == "delete") {
    $this->crud_model->delete_patient_info($patient_id);
    redirect(base_url() . 'index.php?doctor/patient');
    }

    $data['patients'] = $this->crud_model->select_patient_info_by_doctor_id();
    $data['page_name'] = 'manage_patient';
    $data['page_title'] = get_phrase('patient');
    $this->load->view('backend/index', $data);
    }

    как решить? помогите.
     
  2. semki

    semki

    Регистрация:
    20 июл 2016
    Сообщения:
    0
    Симпатии:
    0
    Пишет что нет такой переменной