Login-GroceryCrud
Login-GroceryCrud copied to clipboard
Question - Where do i put the model's inclusion?
Hi! I'm pretty new to GroceryCrud, and I'm trying to set this up. I've read through the detailed instructions but I'm not able to figure out where to put the following line:
$this->load->model('login_model');
Do I put this in my main controller file?
I've coped the 3 files to the respective folders, but it gives me an error indicating that the model
An uncaught Exception was encountered
Type: RuntimeException
Message: Unable to locate the model you have specified: Login_model
Filename: /mydirectory/codeigniter/system/core/Loader.php
Line Number: 348
Backtrace:
File: /mydirectory/codeigniter/application/controllers/Main.php
Line: 17
Function: model
File: /mydirectory/codeigniter/index.php
Line: 315
Function: require_once
Hi, you have to put that line in the __construct() function of your controller. If you don't have it (but you should) you can add it on the top of the controller's function you're using. Just a question: did you copy the Login_model.php file into the /application/model/ folder?
Hi @portapipe,
The _construct function is where i had put it in in my Main.php controller file.
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
$this->load->library('grocery_CRUD');
$this->load->model('Login_model');
}
🤦♂ seems like I had put it into a copy of the application.
This is the error i'm getting now when trying to go to http://mysite/login:
A PHP Error was encountered
Severity: Warning
Message: mkdir(): Invalid path
Filename: drivers/Session_files_driver.php
Line Number: 136
Backtrace:
File: /mydirectory/codeigniter/application/controllers/Login.php
Line: 20
Function: library
File: /mydirectory/codeigniter/index.php
Line: 315
Function: require_once
Warning: Uncaught Exception: Session: Configured save path '' is not a directory, doesn't exist or cannot be created. in /mydirectory/codeigniter/system/libraries/Session/drivers/Session_files_driver.php:138 Stack trace: #0 [internal function]: CI_Session_files_driver->open('', 'ci_session') #1 /mydirectory/codeigniter/system/libraries/Session/Session.php(143): session_start() #2 /mydirectory/codeigniter/system/core/Loader.php(1285): CI_Session->__construct() #3 /mydirectory/codeigniter/system/core/Loader.php(1178): CI_Loader->_ci_init_library('Session', 'CI_', NULL, 'session') #4 /mydirectory/codeigniter/system/core/Loader.php(1043): CI_Loader->_ci_load_stock_library('Session', 'Session/', NULL, NULL) #5 /Users/jtsui/Documents/Personal/T in /mydirectory/codeigniter/system/libraries/Session/drivers/Session_files_driver.php on line 138
Fatal error: session_start(): Failed to initialize storage module: user (path: ) in /mydirectory/codeigniter/system/libraries/Session/Session.php on line 143
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /mydirectory/codeigniter/system/core/Exceptions.php:271)
Filename: core/Common.php
Line Number: 570
Backtrace:
A PHP Error was encountered
Severity: Error
Message: session_start(): Failed to initialize storage module: user (path: )
Filename: Session/Session.php
Line Number: 143
Backtrace:
Edit: Seems like i'm missing something in the application/libraries folder? First error is trying to reference the Login.php file:
$this->load->library('form_validation');
$this->load->library('session');
i don't have anything in my application/libraries folder for session nor form_validation
Your problem now is that you don't have a valid session path. You can set it in your application/config/config.php file (google how to make it the best)