Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:10:18+00:00 2026-06-13T00:10:18+00:00

i am trying to import Mysql column in andorid column here is my php

  • 0

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

[{"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"}]"

//my php file

<?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();
}
?>

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 ?

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<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());
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:10:20+00:00Added an answer on June 13, 2026 at 12:10 am

    add your result data into arraylist and then add it into your db. check the below code for getting all the records coming from the database.

     try{
    
                JSONArray jArray = new JSONArray(result);
    
    
                ArrayList<String> your_array_list = new ArrayList<String>();
                for(int i=0;i<jArray.length();i++){
                        JSONObject json_data = jArray.getJSONObject(i);
    
                        String name=json_data.getString("name");
                         your_array_list.add(name);
    
    
                                        }
    
        }
        catch(JSONException e){
                Log.e("Error", "Error parsing data "+e.toString());
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to import a mysql file to my cpanel phpmyadmin. But I
I'm trying to import a text file into a MySQL database, and I'm having
I'm using MySQL with php. Through a php script i'm trying to import a
I am trying to import a large text file into a MySQL database. The
I'm trying to import a CSV into mysql, and my DateTime column doesn't import
I'm trying to import a very large .csv file (~4gb) into mysql. I was
Im trying to import json data to mysql.My json file nearly 3.7Mb and have
I am trying to import a csv file into a mysql table and I
I am trying to import a CSV file into a MySQL database table. The
I am trying to import a large csv file into MySQL. It's about 1.4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.