每个循环都没有从数组中获取值

On using this code

echo "<pre>";
print_r($result);
echo "</pre>";

i get the following array

Array
(
    [0] => Array
        (
            [0] => S
            [1] => q
        )

    [1] => Array
        (
            [0] => C
            [1] => 
        )

    [2] => Array
        (
            [0] => G
            [1] => 3
        )

    [3] => Array
        (
            [0] => R
            [1] => 
        )

)

i wish to fetch the values and save them in database, but here i wish to save the values when both [0] and [1] has value in it. If any one of them does not hold a value then it should not be saved in database.

I tried to echo the result in [0] and [1] index place but not null value

foreach($result as $value){ 
    //echo $value['0'];    
    //echo $value['1']; 
   $result1 =  $value['0'];    
   $result2 = $value['1']; 
   if($result1!=""&&$result2!="")
     {
          //will run insert query here
     }
   }

can anyone tel how the desired result can be achieved??

remove single quotes from array index, it requires only when associative array is there.

$result1 = $value[0];    
$result2 = $value[1]; 

Try this

foreach($result as $value){ 
//echo $value['0'];    
//echo $value['1']; 
$result1 =  $value[0];    
$result2 = $value[1]; 
if(!empty($result1) && !empty($result2))
 {
      //will run insert query here
 }
}