Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14348

[split] How to echo an array

$
0
0
Masters could you solve this, how to echo this array using 

<?php foreach ($data as $rows): ?>

<?php end foreach:  ?>

i got this array from a var_dump in my model...

my model....


Code:
public function sampleprocm($enrolid)
{



    $sql = 'GET_STUDENT_SUBJECTLOADS_BY_ENROLID()';
    $results = $this->multiple_result_array( $sql );

    echo '<pre>';
    var_dump($results);
    echo '</pre>';

    $sql = 'CALL GET_STUDENT_SUBJECTLOADS_BY_ENROLID('.$enrolid.')';
    $resultss = $this->multiple_result( $sql );

    echo '<pre>';
    var_dump($resultss);
    echo '</pre>';

     // return $resultss;
     return $resultss;


}

my controller..

Code:
public function sampleproc()
{

$data=$this->sections_m->sampleprocm(13);
// var_dump($data);

$this->load->view('pages/registrar/gradingsheet2v', $data);

foreach($data as $key)
{

foreach($key as $value)
{
echo "(".$value->section." ".$value->subject." ".$value->loadid_id." ".$value->grade1." ".$value->grade2." ".$value->grade3." ".$value->grade4." ".$value->average.")";
}
}

}

the output:
Code:
array(1) {
 [0]=>
 array(4) {
   [0]=>
   object(stdClass)#31 (9) {
     ["student"]=>
     string(2) "17"
     ["section"]=>
     string(8) "Hinam-is"
     ["subject"]=>
     string(21) "Afro Asian Literature"
     ["loadid_id"]=>
     string(2) "12"
     ["grade1"]=>
     string(2) "80"
     ["grade2"]=>
     string(2) "79"
     ["grade3"]=>
     string(1) "0"
     ["grade4"]=>
     string(1) "0"
     ["average"]=>
     string(5) "39.75"
   }
   [1]=>
   object(stdClass)#32 (9) {
     ["student"]=>
     string(2) "17"
     ["section"]=>
     string(8) "Hinam-is"
     ["subject"]=>
     string(18) "Araling Panlipunan"
     ["loadid_id"]=>
     string(1) "9"
     ["grade1"]=>
     string(2) "90"
     ["grade2"]=>
     string(2) "85"
     ["grade3"]=>
     string(2) "75"
     ["grade4"]=>
     string(2) "95"
     ["average"]=>
     string(5) "86.25"
   }
   [2]=>
   object(stdClass)#33 (9) {
     ["student"]=>
     string(2) "17"
     ["section"]=>
     string(8) "Hinam-is"
     ["subject"]=>
     string(40) "Music, Arts, Physical Education, Health "
     ["loadid_id"]=>
     string(2) "11"
     ["grade1"]=>
     string(2) "81"
     ["grade2"]=>
     string(2) "83"
     ["grade3"]=>
     string(2) "89"
     ["grade4"]=>
     string(2) "90"
     ["average"]=>
     string(5) "85.75"
   }
   [3]=>
   object(stdClass)#34 (9) {
     ["student"]=>
     string(2) "17"
     ["section"]=>
     string(8) "Hinam-is"
     ["subject"]=>
     string(21) "Philippine Literature"
     ["loadid_id"]=>
     string(1) "8"
     ["grade1"]=>
     string(2) "88"
     ["grade2"]=>
     string(1) "0"
     ["grade3"]=>
     string(1) "0"
     ["grade4"]=>
     string(1) "0"
     ["average"]=>
     string(2) "22"
   }
 }
}
 

(Hinam-is Afro Asian Literature 12 80 79 0 0 39.75)(Hinam-is Araling Panlipunan 9 90 85 75 95 86.25)(Hinam-is Music, Arts, Physical Education, Health 11 81 83 89 90 85.75)(Hinam-is Philippine Literature 8 88 0 0 0 22)


i was trying to retrieve data using a mysql procedure... and that is the output from var_dump.

i used to return data using the usual 

return $query->result();

but now no result..

Viewing all articles
Browse latest Browse all 14348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>