I have this array, and I’ve tried to return it like the same way before.
Example:
$this->permission_array = array(
'orders' => 1,
'orders_Status' => 0,
'schools' => 0,
'accommodation' => 0,
'users' => 1,
'news' => 0,
'blocks' => 1,
'settings' => 0,
'videos' => 1,
);
after implode it and insert to to database it became like this.
USER_ID USER_NAME USER_PERMISSION
---------------------------------------------------
1302 Othman 1,0,0,0,1,0,1,0,1
and now if I used explode it return as an array but the keys are not the same. how I can transfer these values to the same array not like this array:
[0] => 1
[1] => 0
[2] => 0
[3] => 0
[4] => 1
[5] => 0
[6] => 1
[7] => 0
[8] => 1
Is there anyway to change the last array to the first array again? Thank’s in advance.
Create a table of user_permissions:
Then create a table of users_2_permissions
When you want to restore the array, you’ll do a
JOINon users, users_2_permissions and user_permissions.