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 7035681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:19:59+00:00 2026-05-28T01:19:59+00:00

I have an android client with a http GET request invoking a php script

  • 0

I have an android client with a http GET request invoking a php script on the server.. And a php script on my server which queries the database and echoes the resulting rows.. Now, how do i separate the blob file and other fields from the Response?? I have a feeling that the php code is messed up.. It’ll be helpful if you point me in the right direction.. Thanks!

My android code:




HttpClient httpClient = new DefaultHttpClient();

        StringBuilder uriBuilder = new StringBuilder("http://192.168.x.x/file_download.php");


        HttpGet request = new HttpGet(uriBuilder.toString());
        HttpResponse response = httpClient.execute(request);

        int status = response.getStatusLine().getStatusCode();
        Log.i("Http Get",response.getStatusLine().toString());

        // we assume that the response body contains the error message
        if (status != HttpStatus.SC_OK) {
     ByteArrayOutputStream ostream = new ByteArrayOutputStream();
     response.getEntity().writeTo(ostream);
         Log.e("HTTP CLIENT", ostream.toString());
        } else {
    //   InputStream content = response.getEntity().getContent();
         // <consume response>

         String type = response.getEntity().toString();
      content.close(); // this will also close the connection

    }

My php code:

<?php

$conn = mysql_connect("localhost", "root", "root");

if (!$conn) {
    echo "Unable to connect to DB: " . mysql_error();
    exit;
}

if (!mysql_select_db("MYDB")) {
    echo "Unable to select mydbname: " . mysql_error();
    exit;
}

$sql = "SELECT title, filetype, mode, data, time, application, entity_id 
        FROM   table
        WHERE  id=(select max(id) from file)";

$result = mysql_query($sql);

if (!$result) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
    exit;
}

if (mysql_num_rows($result) == 0) {
    echo "No rows found, nothing to print so am exiting";
    exit;
}

$rows = array();

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {



    $rows[]=$row;



}

echo $rows;

mysql_free_result($result);

?>
  • 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-05-28T01:20:00+00:00Added an answer on May 28, 2026 at 1:20 am

    I’m not familiar with the PHP mysql_* functions, so I’m not sure what each row looks like.

    I think it would be easiest for you to format the data on the server side, using PHP, into something that will be easier to parse on the client side, such as JSON or XML.

    I don’t know the PHP for that part either, but this might be a step in the right direction: Convert MySQL record set to JSON string in PHP

    Then you could use the org.json package classes to parse on the client side. This doesn’t directly address your question about separating the blobs, but doing it this way will make your blobs accessible on the JSON object (probably keyed by the name of the column).

    Good luck.

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

Sidebar

Related Questions

I have following scenario: The Android clients communicate with a PHP server via HTTP
I have a simple client-server app on android. the android service communicates with the
In my current app for Android I have an HTTP client that sends a
i have an Http client in my android app that changes messages with a
I currently have a Service in Android that is a sample VOIP client so
I have Android pet-project DroidIn which utilizes HttpClient 4 (built into Android) to do
I have an Android client that needs to authenticate with a python Google App
I have done the following tutorial: http://www.anddev.org/networking-database-problems-f29/connecting-to-mysql-database-t50063.html for connecting an android device to an
I tried uploading an audio file from android client to server but I'm getting
I am trying to call HTTP request with network credential in blackberry. i have

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.