Welcome Guest, Not a member yet? Register   Sign In
$this->load->database(); doesn't work in models
#4

[eluser]krankmelder[/eluser]
@TWP Marketing: Well I had autoload on before, but it doesn't make a difference. Also, I wanted to check, wether the $this->load->database() command works in the controler, which it does.

@WanWizard: Interesting, the var_dump in the Controler gives a lot of information, while the var_dump in the model returns NULL.
Code:
var_dump START in Controler
object(CI_Loader)#13 (12) {
  ["_ci_ob_level":protected]=>
  int(1)
  ["_ci_view_paths":protected]=>
  array(1) {
    ["application/views/"]=>
    bool(true)
  }
  ["_ci_library_paths":protected]=>
  array(2) {
    [0]=>
    string(12) "application/"
    [1]=>
    string(36) "E:/xampp180/htdocs/pdbase_v1/system/"
  }
  ["_ci_model_paths":protected]=>
  array(1) {
    [0]=>
    string(12) "application/"
  }
  ["_ci_helper_paths":protected]=>
  array(2) {
    [0]=>
    string(12) "application/"
    [1]=>
    string(36) "E:/xampp180/htdocs/pdbase_v1/system/"
  }
  ["_base_classes":protected]=>
  array(12) {
    ["benchmark"]=>
    string(9) "Benchmark"
    ["hooks"]=>
    string(5) "Hooks"
    ["config"]=>
    string(6) "Config"
    ["log"]=>
    string(3) "Log"
    ["utf8"]=>
    string(4) "Utf8"
    ["uri"]=>
    string(3) "URI"
    ["router"]=>
    string(6) "Router"
    ["output"]=>
    string(6) "Output"
    ["security"]=>
    string(8) "Security"
    ["input"]=>
    string(5) "Input"
    ["lang"]=>
    string(4) "Lang"
    ["loader"]=>
    string(6) "Loader"
  }
  ["_ci_cached_vars":protected]=>
  array(0) {
  }
  ["_ci_classes":protected]=>
  array(2) {
    ["session"]=>
    string(7) "session"
    ["form_validation"]=>
    string(15) "form_validation"
  }
  ["_ci_loaded_files":protected]=>
  array(2) {
    [0]=>
    string(57) "E:/xampp180/htdocs/pdbase_v1/system/libraries/Session.php"
    [1]=>
    string(65) "E:/xampp180/htdocs/pdbase_v1/system/libraries/Form_validation.php"
  }
  ["_ci_models":protected]=>
  array(0) {
  }
  ["_ci_helpers":protected]=>
  array(3) {
    ["url_helper"]=>
    bool(true)
    ["form_helper"]=>
    bool(true)
    ["string_helper"]=>
    bool(true)
  }
  ["_ci_varmap":protected]=>
  array(2) {
    ["unit_test"]=>
    string(4) "unit"
    ["user_agent"]=>
    string(5) "agent"
  }
}

var_dump END in Controler

var_dump START in Model
NULL

var_dump END in Model


Fatal error: Call to a member function database() on a non-object in E:\xampp180\htdocs\pdbase_v1\application\models\loginmodel.php on line 24

I reckon it's something with the CI instance? I had a similar problem I think back with CI 1.7 or something. But shouldn't it work like I did in CI 2.1.2?


Messages In This Thread
$this->load->database(); doesn't work in models - by El Forum - 09-05-2012, 05:03 AM
$this->load->database(); doesn't work in models - by El Forum - 09-05-2012, 01:23 PM
$this->load->database(); doesn't work in models - by El Forum - 09-05-2012, 01:56 PM
$this->load->database(); doesn't work in models - by El Forum - 09-06-2012, 12:48 AM
$this->load->database(); doesn't work in models - by El Forum - 09-06-2012, 01:12 AM
$this->load->database(); doesn't work in models - by El Forum - 09-06-2012, 01:15 AM
$this->load->database(); doesn't work in models - by El Forum - 09-06-2012, 01:25 AM
$this->load->database(); doesn't work in models - by El Forum - 09-06-2012, 01:34 AM
$this->load->database(); doesn't work in models - by El Forum - 09-06-2012, 01:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB