CodeIgniter syntax

做~自己de王妃 提交于 2020-01-16 17:35:28

问题


Here is my code:

$this->load->model('login/configurations', '', TRUE);
$data['query'] = $this->configurations->load_data();

But my query is not being loaded here:

$data['title'] = 'User Area';
$data['main_content'] = 'resources/logged_in_area';
$this->load->view('templates/resources_area', $data);

I think it may have to do with the path of my model. "Login" is the name of the folder "configurations" is in. The title and main_content variables are loaded into my view. The resources area template loads my header, footer and nav views. So I know the last three lines of code are valid. It's the first three that are not working.

Here is my load_data function:

function load_data() {

    $query = $this->db->query("SELECT * FROM configurations WHERE username=" . $this->session->userdata('username'));
    return $query;

   }

Anyone have any thoughts? I get an undefined variable error in my view. ($query)

来源:https://stackoverflow.com/questions/4708994/codeigniter-syntax

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!