title: Dynamic Array overwrite again
body: <p>I want to know how to add array dynamically in array b1 and b2 because if condition is called more than one time then b1 overwrite itself and so is the case with b2. </p>
  
  <pre><code>$sql = "SELECT senderid , receiverid,request FROM friendrequest WHERE request = '1'";
      $result = mysqli_query($con,$sql);
      $u1 = array();
      $u2 = array();
      $b1 = array();
      $b2 = array();
  
  
  while ($row =mysqli_fetch_array($result)){
  
      if(($row['senderid']==$senderid)){
          $value = $row['receiverid'];
          $u1['receiverid']=$value;
          $b1 = array($u1['receiverid']);    
  
      }else if(($row['receiverid']==$senderid)){
          $value = $row['senderid'];
          $u2['senderid']=$value;
          $b2 = array($u2['senderid']);
  
      }
  
      $b=array_merge($b1,$b2);
  }
  </code></pre>
  
  <p>I have also tried another logic code but it gives me error.</p>
  
  <pre><code>$sql = "SELECT senderid , receiverid,request FROM friendrequest WHERE request = '1'";
  $result = mysqli_query($con,$sql);
  $u1 = array();
  $u2 = array();
  $b1 = array();
  $b2 = array();
  $f1=0;
  $f2=10;
  
  while ($row =mysqli_fetch_array($result)){
      $f1=$f1+1;
      if(($row['senderid']==$senderid)){
          $value = $row['receiverid'];
          $u1['receiverid']=$value;
          $b1[$f1] = array($u1['receiverid']);    
  
      }else if(($row['receiverid']==$senderid)){
          $value = $row['senderid'];
          $u2['senderid']=$value;
          $b2[$f1] = array($u2['senderid']);
  
      }
  
      $b=array_merge($b1,$b2);
  }
  </code></pre>