Mike Depies
Mike Depies

Reputation: 815

Codeigniter phpActiveRecord Create error

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

Upvotes: 0

Views: 207

Answers (3)

Vinit Kadkol
Vinit Kadkol

Reputation: 1285

This is caused due to absence of auto-increment field in your table. Please add auto-increment field.

I had faced the same issue.

Upvotes: 0

Brian
Brian

Reputation: 36

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.

Upvotes: 2

Sam Dufel
Sam Dufel

Reputation: 17598

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.

Upvotes: 0

Related Questions