![]() |
How to show error messages from models? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to show error messages from models? (/showthread.php?tid=53027) |
How to show error messages from models? - El Forum - 07-08-2012 [eluser]Alhazred[/eluser] I'm developing my first application using CI, from a controller I call a model, but at the call the application stops. If I remove the model call the application goes on. I'm sure to call the model in the correct way, because if I put a wrong name for it I get a message for an inexistent model. The problem must be inside the model, but I don't get any error message, how do I find where the problem is? I tried to put some echo as debug and then exit(), but they don't appear. Is there something to do to show php errors from models? How to show error messages from models? - El Forum - 07-08-2012 [eluser]Alhazred[/eluser] I add some code because it looks the problem is not sure to be inside the model, I've left only the constructor inside it and the problem persists. Controller Code: class Authentication extends CI_Controller Model [code] class Authentication extends CI_Model { function __construct() { parent::__construct(); } } How to show error messages from models? - El Forum - 07-08-2012 [eluser]InsiteFX[/eluser] Because you have the first character upper case should be this Code: $this->load->model('authentication/authentication'); How to show error messages from models? - El Forum - 07-08-2012 [eluser]Alhazred[/eluser] I've tried but that didn't help. I've solved in this way Renamed the model file from authentication.php to authentication_model.php Model's code Code: class Authentication_model extends CI_Model Controller's code Code: $this->load->model('authentication/Authentication_model'); In other words I have added _model to the model class name and filename. Is it required to use _model? From the user guide seems it is not, but without the code doesn't work. How to show error messages from models? - El Forum - 07-08-2012 [eluser]Aken[/eluser] The class name has to match the file name. If your model class is named "Authentication", your file name should be "authentication.php". If you name it "Authentication_model", authentication_model.php, etc... Also make sure you do not have any controllers and models with the same class name, or you'll receive an error. How to show error messages from models? - El Forum - 07-08-2012 [eluser]Alhazred[/eluser] [quote author="Aken" date="1341777974"]... Also make sure you do not have any controllers and models with the same class name, or you'll receive an error.[/quote] This is the problem then, the controller class is named Authentication too. Thank you. |