Я новичок с CI, и я использую CI v.2.2.1, я хочу отправить данные с моего контроллера на модель, но у меня есть некоторые проблемы здесь. Ошибка говорит, что моя модель undefined property
. вот мой код:как отправить данные с контроллера на модель с помощью CodeIgniter
Контроллер: users.php
public function postUser(){
$username = $this->input->post('username');
$password = $this->input->post('password');
$email = $this->input->post('email');
$phone = $this->input->post('phone');
$address = $this->input->post('address');
$level = $this->input->post('level');
$status = $this->input->post('status');
$this->load->model('model_crud');
$query = $this->model_crud->insert('Users',$_POST);
echo "$query";
}
Модель: model_crud.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Model_crud extends CI_Model {
public function __construct(){
parent::__construct();
}
public function insert($table,$data){
$query = $this->db->insert($table,$data);
return $query;
}
}
есть любой конфигурации использовать модель или мой код не так? Может ли кто-нибудь мне помочь? Thx