'After removing foreach, no data is displayed

Enrol table: enter image description here

From this table I try get value from active_shop

Here I have code:

<?php 
$get_config_details = $this->db->get('enrol',$per_page, $this->uri->segment(1));
?>
<?php if ($get_config_details->num_rows() > 0):
                foreach($get_config_details->result_array() as $get_config_detail):
                    $course_details = $this->crud_model->get_course_by_id($get_config_detail['course_id'])->row_array();?>
<?php echo $get_config_detail['active_shop']; ?>
<?php endforeach; ?>
            <?php endif; ?>
            

Now I get the result: 1

But I copied this function from another function. I don't need the foreach function and if and so much code here. I need some simple code to squeeze this table and echo the result. Can anyone help me to correct this code?

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source