title: How to add JSON Array name in JSON
body: <p>I am new in PHP and just trying to encode mysql table's data into JSON format, and to get that i am using below script:</p>
  
  <pre><code>&lt;?php
      $objConnect = mysql_connect("localhost","root","root");
      $objDB = mysql_select_db("mydatabase");
      $strSQL = "SELECT * FROM member WHERE 1  ";
      $objQuery = mysql_query($strSQL);
      $intNumField = mysql_num_fields($objQuery);
      $resultArray = array();
      while($obResult = mysql_fetch_array($objQuery))
      {
          $arrCol = array();
          for($i=0;$i&lt;$intNumField;$i++)
          {
              $arrCol[mysql_field_name($objQuery,$i)] = $obResult[$i];
          }
          array_push($resultArray,$arrCol);
      }
  
      mysql_close($objConnect);
  
      echo json_encode($resultArray);
  ?&gt;
  </code></pre>
  
  <p>and getting result in below format:</p>
  
  <pre><code>    [
      {
        "MemberID":"1",
        "Name":"Weerachai"
      },
      {
        "MemberID":"2",
        "Name":"Win"
      }
  ]
  </code></pre>
  
  <p>But what if i want to get response like this:</p>
  
  <pre><code>{
    "members": [ // i want to add this array
      {
        "MemberID":"1",
        "Name":"Weerachai"
      },
      {
        "MemberID":"2",
        "Name":"Win"
      }
    ]
  }
  </code></pre>