Welcome Guest, Not a member yet? Register   Sign In
How to fix function to return multi array ci 3
#1

i test with function below

PHP Code:
public function getexam_result($bode)
    {
        foreach(
$bode as $v)
 
       {
         
 $this->db->where('question_id',$v);
         
 $q=$this->db->get('answer_true');
         
 $rs=$q->result();
 
         $ans=array();
 
         foreach($rs as $v1)
 
         {
 
           $ans[]=$v1->answer_id;
 
         }
 
           return $ans;
 
       }
 
  
if i return  it only one array
PHP Code:
Array
(
 
   [0] => 1
    
[1] => 2


when i print array $ans it show array
PHP Code:
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 1
    
[1] => 3
)
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 1
)
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 1
)
Array
(
 
   [0] => 1
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 2
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 3
)
Array
(
 
   [0] => 1
    
[1] => 2
)
Array
(
 
   [0] => 2
)
<
pre

how to fix to return multi array
thank you in advance
Reply


Messages In This Thread
How to fix function to return multi array ci 3 - by Khanh Minh - 01-21-2017, 04:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB