I am trying to get a group tabel to work on my website. I have three tables in my db. One is for users. Second is a list of different group names. The last one is a table with all the details that each group has an access too. The last table have a parentGroup that matches the groupListID and have a row called access. It can be any kind of number, per example 1-100.
Then I am trying to get a if statement if any of the access numbers matches number one, in this example:
$this->db->where('parentGroup', $groups);
$this->db->select('access');
$query = $this->db->get('groupDetail');
$array = $query->result_array();
$key = array_search(1, array_column($array, 'access'));
if (array_search(1, array_column($array, 'access'))) {
echo 'This array does contain the number one';
}
else
{
echo 'This array does not contain the number one';
//redirect('dashboard');
}
The problem is that it does not print out the value of access, but the value of the array that have the value of access and that cannot be used in my if statement...
I hope that this makes sense? Any help is really appreciated!