Codeigniter phpActiveRecord Create error
-
10-06-2021 - |
Question
class User extends ActiveRecord\Model
{
pubic static $primary_key = 'userId';
private function isUserLoggedIn() {}
}
The error I get:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: lib/Model.php
Line Number: 830
La solution
This is a few months late, but I'm just getting into php-activerecord myself.
Your problem might be that you typed "pubic" instead of "public", and php by default doesn't support any pubic variables.
Autres conseils
Your problem is going to be in your Users model. It's possible you didn't extend CI_Model, you didn't call parent::construct() in the users constructor, or there is some other error in there.
This is caused due to absence of auto-increment field in your table. Please add auto-increment field.
I had faced the same issue.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow