How to pass all records from result using JSCONArray
<p>i am trying to import Mysql column in andorid column here is my php file which getting column values it  showing me all records
like this</p>

<pre><code>[{"nome":"A BARATEIRA DE TECIDOS LIMITADA ME"}][{"nome":"A BARATEIRA DE TECIDOS LIMITADA ME"},{"nome":"A.A.L. COMESTIVEIS E RESTAURANTE LTDA ME"}][{"nome":"A BARATEIRA DE TECIDOS LIMITADA ME"},{"nome":"A.A.L. COMESTIVEIS E RESTAURANTE LTDA ME"},{"nome":"ACOUGUE E MERCEARIA COSTELAO DA SERRA LTDA ME"}]"
</code></pre>

<p>//my php file</p>

<pre><code>&lt;?php
mysql_connect("localhost","root","abcd");
mysql_select_db("fabricacao");
$sql=mysql_query("SELECT nome FROM cliente ORDER BY NOME") ;
$nome ='nome';
while($rows=mysql_fetch_assoc($sql))
{
$output[]=$rows;
 print(json_encode($output));
mysql_close();
}
?&gt;
</code></pre>

<p>my problem is here when i am converting records of result into Array then  JSONArray.lenght() showing 'size =1' and inseting just first one record, i dont understand where is problem i want store all rows ?</p>

<pre><code>try
{
   JSONArray  jArray = new JSONArray(result);
  //mydb
       sql= openOrCreateDatabase("CLT",SQLiteDatabase.CREATE_IF_NECESSARY,null);
       ContentValues values=new ContentValues(); 
       int n = jArray.length();
        for(int i=0;i&lt;jArray.length();i++)
        {
        JSONObject json_data = jArray.getJSONObject(i);
        values.put("CLIENT", json_data.getString("nome"));
         sql.insert("clnt", null, values);
        }
       sql.close();

    }catch(Exception e)
    {
        Log.e("Erro",e.toString());
    }
</code></pre>
