kishor10d/Admin-Panel-User-Management-using-CodeIgniter

Trying to get property 'access' of non-object

mayankrajs24 opened this issue · 6 comments

I am getting This error on Online server but in local its working..

There are two errors
1)Trying to get property 'access' of non-object
2)Invalid argument supplied for foreach()

Untitled
Untitlesd

@mayankrajs24 : It looks like you uploaded the code correctly but not the database. Please check that in your tbl_access_matrix, there is a field name access is present or not

I have checked and Imported the table correctly.
access is present

@mayankrajs24 Then check, which user you are trying to login, and you don't have data for him in that tbl_access_matrix. This is not the issue actually, still we can try to solve here. .

Username : admin@example.com
Pass : admin

@mayankrajs24 : I am not asking to confirm this. Please check record is there which is associated with admin user's roleId or not.

If you are unable to figure out, then execute below query on database, and then try login.

INSERT INTO `tbl_access_matrix` (`id`, `access`, `roleId`, `isDeleted`, `createdBy`, `createdDtm`, `updatedBy`, `updatedDtm`) VALUES (NULL, '[{\"module\":\"Task\",\"total_access\":0,\"list\":0,\"create_records\":0,\"edit_records\":0,\"delete_records\":0},{\"module\":\"Booking\",\"total_access\":0,\"list\":0,\"create_records\":0,\"edit_records\":0,\"delete_records\":0}]', '1', '0', '1', '2022-08-19 15:21:25', NULL, NULL);

@mayankrajs24 : Hi Mayank, I took this as bug, and now provided the fix. You can pull new master branch with the change. Or you can go with above mentioned query.