I have an array as such:
Array([0]=>1001 [1]=>1002 [2]=>1003 [3]=>1004)
Array([0]=>2001 [1]=>2002 [2]=>2003)
I am trying to display the array in a table like below:
| Location | user |
|---|---|
| Office | 4 |
| Canteen | 3 |
The user column is supposed to display the total count in the array. I am able to do that, however I am trying to display the array values when the number is clicked. Please help me solve this issue.
User_model.php
function get_user_count($location){
$this->db->select('user_id');
$this->db->from('time_location');
$this->db->where('location', $location);
$this->db->where('ack', 1);
$query = $this->db->count_all_results();
controller.php
$status = $this->User_model->get_user_count($location);
if($status){
$object_id = array_column($status, 'user_id');
$this->table->add_row($location, $object_id);
} else{
$object_id = 0;
$this->table->add_row($location, $object_id);
}
So far I am able to do this to display the total user count in the location. How to make the count value as a link/button where if clicked, it will display the user_id array?
1 Answer 1
this is the Magento community .
Your code seems to be written in another PHP framework.
I think you are using the CI or Laravel framework, ask your question to the CI/Laravel or https://stackoverflow.com/ community.