如何在代码点火器错误中获取和显示数据库表值即将到来



我是一个新的代码点火器开发人员,遇到了一个错误。我在数据库中存储了一些值,并希望在查看页面中显示它。请帮帮我。

控制器

function get_user_value()  {
$data['query'] = $this->user_m->user_data_set($query);
$this->load->view('user_settings', $data);  }

  public function user_details()
{
// $query = $this->db->select('*')->from('user')->get();
 $query = $this->db->get('user');
   return $query->$result();
}

试试这个:注意首先将模型调用控制器首先添加此函数 _construct()

function __construct() {
        parent::__construct();
        $this->load->model("model_file_name", "model_name_alias");
        //Example $this->load->model("user_model","user");
        //the "user_model" is the file name in your model folder 
}
function get_user_value()  {
  $data['query'] = $this->model_name_alias->user_details();
  $this->load->view('user_settings', $data);  
}

最新更新