CodeIgniter Forums
problem in view page - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: problem in view page (/thread-41507.html)

problem in view page - El Forum - 05-10-2011

[eluser]Bigil Michael[/eluser]
$build_array = array();
       $sub_result = array();
        $fleets = $this->Classifieds_model->select_all_classifieds();
        foreach($fleets as $row){
            $sub = $this->Classifieds_model->list_all_classifieds($row['id']);
            foreach($sub as $subsub)
                $sub_result[] = $this->Classifieds_model->count_classifieds($subsub['id']);
            $build_array[] = array (
                'fleets_array' => $row,
                'listefleets_array' => $sub,
                'list' => $sub_result
        $meow = $build_array;
        $this->data['meow'] = $meow;  
function count_classifieds($parent=0)
        $result_total    =    $this->db->query("SELECT COUNT(id) AS total  FROM classifieds WHERE categoryid='$parent' AND status=1");
            $row    = $result_total->row();
            $count    =    $row->total;
        return $count;
<?php foreach($meow as $crow){?>
    <?php echo $crow['fleets_array']['heading'];?>
        foreach ($crow['listefleets_array'] as $lrow){?>
            <?php echo $lrow['heading'];?>
                    <?php foreach($crow['list'] as $krow) {
                        echo $krow;
        <?php  } ?>
<?php } ?>
in the result page it prints like this

i want to print the count only
can anyone solve this problem???

in the controller iam getting the correct result, but i totally failed to send it to the view............

problem in view page - El Forum - 05-10-2011

At least link to your previous thread so people can read the backstory on everything that you've tried...

and post a var_dump of $meow, so that the people can see the final generated array... cuz you're just having a problem now figuring out how to play with your array (standard array functions).

Also... get rid of those php open and close tags on each line in your form... enclose the whole section and be done with it, or use foreach template tages <?foreach($a as $b):?> etc