title: How To Add Result From Method To The Result of SQL From Php Array - JSON
body: <p>I'm working in <code>loginModel.php</code>. And extracting it's results, in the mean time encoding the image to <code>base64</code> to pass the result to <code>JSON</code> with the user info. </p>
  
  <p>The decoding for the image will be in <code>Android App</code> and I was trying to put/attach the <code>encodedString</code> (locating the image - path and name) result that come from different method to <code>$result</code> </p>
  
  <p>(The sql query only return info that was <code>SELECT</code> ). </p>
  
  <p>Here's my php file:</p>
  
  <pre><code>$result = mysqli_query($this-&gt;db-&gt;connect,$sql_login); 
  
             //CHECK RESULT
                  $rowCheck = mysqli_num_rows($result);
                  if ($rowCheck &gt; 0) {
                      $result             = mysqli_fetch_array($result);
                      $profPath           = $result['PicturePath'];
                      $profName           = $result['ProfilePicture'];
                      $salt               = $result['SaltPassword'];
                      $encrypted_password = $result['Password'];
                      //ENCODED STRING
                      $encodedString = $this-&gt;encodeProfBaseString($profName,$profPath);
                      $result['encodedString'] = $result['$encodedString'];
  
                      //CALL checkHashSaltSHA METHOD
                      $hash = $this-&gt;checkHashSaltSHA($salt,$userPassword);
  
                      //CHECK PASSWORD
                      if ($encrypted_password == $hash) {
                              return $result;
                      }
                      else{
                          return FALSE;
                      }        
                  }
  </code></pre>
  
  <p><strong>All I want is to make <code>encodedString</code> will be return as well, as a part of <code>$result</code>.</strong> How can I insert the result from array <code>$result</code>?</p>
  
  <p><a href="https://i.stack.imgur.com/AlIbs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AlIbs.png" alt="encode"></a></p>