Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter on Ubuntu not Loading Model
    primarykey
    data
    text
    <p>I've recently switched from Windows 7 to Ubuntu.. Now I'm having this strange problem with codeigniter.. My code works prefect on Widnows 7 Xampp server, but when I try to access it on ubuntu having apache2, I cannot load any model, libraries etc. </p> <p>Here is my code for model</p> <pre><code>&lt;?php class Usermodel extends CI_Model { function __construct() { // Call the Model constructor parent::__construct(); $this-&gt;user_per_page = 8; } function getUser($id) { $query = $this-&gt;db-&gt;query("SELECT * FROM user WHERE id = $id"); if(intval($query-&gt;num_rows()) &gt; 0) { $data = $query-&gt;result(); return $data[0]; } else return null; } } </code></pre> <p>Here is the code of my controller where i am loading model</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Register extends CI_Controller { public function index() { $this-&gt;load-&gt;model("Usermodel"); $fb_config = array( 'appId' =&gt; 'xxxxxxxxxxx', 'secret' =&gt; 'xxxxxxxxxxxxxxxxxxxxxxxx' ); $this-&gt;load-&gt;library('facebook', $fb_config); $this-&gt;load-&gt;helper('security'); } } </code></pre> <p>I've already tried the following</p> <p><strong>1. Changed usermodel.php to Usermodel.php 2. Changed $this-load->model("Usermodel") to $this-load->model("usermodel")</strong></p> <p>but none seem to work</p> <p>I get this fatal error when i call $this->Usermodel->getUser(1) in index() function of my controller</p> <p><strong>PHP Fatal error: Call to a member function getUser() on a non-object in /var/www/voicebuds/application/controllers/register.php on line 19, referer: mysite</strong></p> <p><strong>UPDATE</strong> If i put the Usermodel in config/autoload.php, it works fine.. So I must say there is some problem with loader function.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload