title: create custom json array from database result in php?
body: <p>Hi I have some table say fro example table1 ,table2 in my mysql databse.
  I need to get following json result from php.
  Can anyone suggest how to achieve this?
  any good tutorial doing same is also helpful.
  I am able to convert database result in simple json response but custom response is something difficult for me. </p>
  
  <pre><code>{
  response:ok
  tables:[
  {
      name:table name
          data:[
                  {
                  fieldname1:value1
                  fieldname2:values2
                  },
                  {
                  fieldname1:value1
                  fieldname2:value2
                  }
                  .
                  .
              ]               
  },
  {
      name:table name1
          data:[
                  {
                  fieldname1:value1
                  fieldname2:values2
                  },
                  {
                  fieldname1:value1
                  fieldname2:value2
                  }
                  .
                  .
              ]               
  },
  
  ]
  }
  }
  </code></pre>