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

  • Home
  • SEARCH
  • 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 8993127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:07:26+00:00 2026-06-15T23:07:26+00:00

I have design my database on MySQL and link it through php. how can

  • 0

I have design my database on MySQL and link it through php. how can i get it on android application by using HTTP GET method??? i used JSON Parsing for this purpose to get data from MYSQL but i fails to display:((
Now i want to get data from HTTP GET request so how can i use it?? does i upload my database on server??? how can i upload it?? and what is the method for it. i’ll be thankful to you for help

MySQL database is:

    <?php
// read_My_Task.php


/*
 * Following code will get single task details
 * A task_detail is identified by task id (cid)
 */
 // array for JSON response
$response = array();

// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// check for post data
if (isset($_GET["cid"])) {
    $cid = $_GET['cid'];

    // get a task from my-task table
    $result = mysql_query("SELECT *FROM my_task WHERE cid = $cid");

    if (!empty($result)) {
        // check for empty result
        if (mysql_num_rows($result) > 0) {

            $result = mysql_fetch_array($result);

            $my_task = array();
            $my_task["cid"] = $result["cid"];
            $my_task["cus_name"] = $result["cus_name"];
            $my_task["contact_number"] = $result["contact_number"];
            $my_task["ticket_no"] = $result["ticket_no"];
            $my_task["task_detail"] = $result["task_detail"];

            // user node
            $response["my_task"] = array();

            array_push($response["my_task"], $my_task);
            // echoing JSON response
            echo json_encode($response);         
             }            

        else {
            // no task found
            $response["success"] = 0;
            $response["message"] = "No task found";

            // echo no users JSON
            echo json_encode($response);
        }
    } else {
        // no task found
        $response["success"] = 0;
        $response["message"] = "No task found";

        // echo no users JSON
        echo json_encode($response);
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing";

    // echoing JSON response
    echo json_encode($response);
}

?>

LogCat errors are:

12-17 11:00:39.180: W/System.err(10667): org.apache.http.conn.ConnectTimeoutException: Connect to /198.168.0.29:80 timed out
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:143)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
12-17 11:00:39.180: W/System.err(10667):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
12-17 11:00:39.180: W/System.err(10667):    at com.example.visit.record.JSONParser.makeHttpRequest(JSONParser.java:62)
12-17 11:00:39.180: W/System.err(10667):    at com.example.visit.record.My_Task$GetTaskDetails.doInBackground(My_Task.java:170)
12-17 11:00:39.180: W/System.err(10667):    at com.example.visit.record.My_Task$GetTaskDetails.doInBackground(My_Task.java:1)
12-17 11:00:39.180: W/System.err(10667):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-17 11:00:39.180: W/System.err(10667):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
12-17 11:00:39.180: W/System.err(10667):    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
12-17 11:00:39.180: W/System.err(10667):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
12-17 11:00:39.180: W/System.err(10667):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
12-17 11:00:39.190: W/System.err(10667):    at java.lang.Thread.run(Thread.java:1027)
12-17 11:00:39.190: E/Buffer Error(10667): Error converting result java.lang.NullPointerException
12-17 11:00:39.190: E/JSON Parser(10667): Error parsing data org.json.JSONException: End of input at character 0 of 
12-17 11:00:39.190: W/dalvikvm(10667): threadid=9: thread exiting with uncaught exception (group=0x400205a0)
12-17 11:00:39.200: E/AndroidRuntime(10667): FATAL EXCEPTION: AsyncTask #1
12-17 11:00:39.200: E/AndroidRuntime(10667): java.lang.RuntimeException: An error occured while executing doInBackground()
12-17 11:00:39.200: E/AndroidRuntime(10667):    at android.os.AsyncTask$3.done(AsyncTask.java:200)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.lang.Thread.run(Thread.java:1027)
12-17 11:00:39.200: E/AndroidRuntime(10667): Caused by: java.lang.NullPointerException
12-17 11:00:39.200: E/AndroidRuntime(10667):    at com.example.visit.record.My_Task$GetTaskDetails.doInBackground(My_Task.java:174)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at com.example.visit.record.My_Task$GetTaskDetails.doInBackground(My_Task.java:1)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-17 11:00:39.200: E/AndroidRuntime(10667):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
12-17 11:00:39.200: E/AndroidRuntime(10667):    ... 4 more
12-17 11:00:39.510: E/WindowManager(10667): Activity com.example.visit.record.My_Task has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4054caf0 that was originally added here
12-17 11:00:39.510: E/WindowManager(10667): android.view.WindowLeaked: Activity com.example.visit.record.My_Task has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4054caf0 that was originally added here
12-17 11:00:39.510: E/WindowManager(10667):     at android.view.ViewRoot.<init>(ViewRoot.java:277)
12-17 11:00:39.510: E/WindowManager(10667):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
12-17 11:00:39.510: E/WindowManager(10667):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
12-17 11:00:39.510: E/WindowManager(10667):     at android.view.Window$LocalWindowManager.addView(Window.java:433)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.Dialog.show(Dialog.java:288)
12-17 11:00:39.510: E/WindowManager(10667):     at com.example.visit.record.My_Task$GetTaskDetails.onPreExecute(My_Task.java:149)
12-17 11:00:39.510: E/WindowManager(10667):     at android.os.AsyncTask.execute(AsyncTask.java:391)
12-17 11:00:39.510: E/WindowManager(10667):     at com.example.visit.record.My_Task.onCreate(My_Task.java:108)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.ActivityThread.access$1500(ActivityThread.java:132)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
12-17 11:00:39.510: E/WindowManager(10667):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-17 11:00:39.510: E/WindowManager(10667):     at android.os.Looper.loop(Looper.java:143)
12-17 11:00:39.510: E/WindowManager(10667):     at android.app.ActivityThread.main(ActivityThread.java:4268)
12-17 11:00:39.510: E/WindowManager(10667):     at java.lang.reflect.Method.invokeNative(Native Method)
12-17 11:00:39.510: E/WindowManager(10667):     at java.lang.reflect.Method.invoke(Method.java:507)
12-17 11:00:39.510: E/WindowManager(10667):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-17 11:00:39.510: E/WindowManager(10667):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-17 11:00:39.510: E/WindowManager(10667):     at 

it gives error:

Status Code: 404 Not Found
Accept-Ranges: bytes
Content-Language: en
Content-Type: text/html; charset=iso-8859-1
Date: Mon, 17 Dec 2012 06:40:56 GMT
Keep-Alive: timeout=5, max=100
Proxy-Connection: Keep-Alive
Server: Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
Transfer-Encoding: chunked
Vary: accept-language,accept-charset


Method: POST
URL: http://192.168.0.29/mobile/read_mytask.php?cid=1
Body: 
cid=cid &
cus_name=c
& contact_no=n
& ticket_no=t
& taskdetail=td
  • 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-15T23:07:27+00:00Added an answer on June 15, 2026 at 11:07 pm

    I’ll give you an overview on how client-server data retrieval works in Android. You can tailor it to your specific requirements from there since your question indicates large foundational knowledge gaps to me.

    You’ll have to create REST API’s (by writing server side code using a language like PHP, Ruby, Python etc) that your Android app can consume to obtain the data from your MySQL database.

    There are other options that avoid REST API’s as well. See:

    How to get from a MySql server to an Android app?

    See here for a beginners tutorial on REST:

    http://net.tutsplus.com/tutorials/other/a-beginners-introduction-to-http-and-rest/

    Once you have your API’s written. You can query them using HTTP GET request and parse the result. If you are returning the data in JSON format, here’s a tutorial on how to parse it:

    http://www.vogella.com/articles/AndroidJSON/article.html

    Now you can store the parsed data on your local database using the native android methods. See db tutorial here:

    http://www.vogella.com/articles/AndroidSQLite/article.html

    Once all this is over. You can do CRUD operations on your local database to read/manipulate your data and display them to the user using the XML based Android UI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webapp written in PHP using a MySQL database backend. This question
I have a design headache here, I'm using PHP and MySQL in conjunction with
I have a Private messaging system using PHP and mySQL with notification. The database
I'm using singleton design-pattern for my database connection. Here is my method. private static
What would be the best way to design this MySQL database? I have cars
Someone asked me to design a database and implement it using MySQL. Additionally, I
I have to adapt a PHP-script that is connected to a extremely messy database-design.
I'm currently developing a web application using MYSQL database InnoDB format and need some
I am creating a MySQL database for quiz bowl. The design is to have
What do I have to consider in database design for a new application which

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.