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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:58:17+00:00 2026-06-08T05:58:17+00:00

I’m new to PHP and I have been researching how to send and receive

  • 0

I’m new to PHP and I have been researching how to send and receive data from Android to MySQL using a PHP web layer. I had previously prepared my code to create the Java string arrays emailAddresses[] and phoneNumbers[] which respectively contain all of the email addresses and phone numbers of the phone’s contacts.

I want to check each of these values against a MySQL table DATA which contains the fields DATA_TYPE and DATA_CONTENT, which respectively identifies the data as a phone number/email address/other item, and contains the data. I think it best if I load the arrays into PHP and then loop through each of their values to see if a query returns a record. If it does, then I want to build all of the other data in DATA associated to the user with that phone number/email address into a JSON response for Android, which it will later use to copy the data into its own SQLite DB.

I am unsure of how best to handle the input and output for PHP here though. Most examples I see involve setting NameValuePairs as the entity with HTTPPOST, but the examples also seem only to use these as parameters for identifying or copying data from a single record, e.g. for logging in, whereas I want to pass lots of data of the same type (email/phone) for identifying lots of records. I thought it might be a case of specifying the keys as “email[1]”,”someone@somewhere.com” “email[2]”,”another@somewhere.com” but as I am new to PHP, I wasn’t sure how efficient that would be, especially with 100 or so addresses. I’d appreciate some guidance in my new furore, thanks.

  • 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-08T05:58:18+00:00Added an answer on June 8, 2026 at 5:58 am

    First of all, if you need to pass a lot of data, regardless of the format, it will be slow. How slow is “too slow” is up to your specific application and its requirements. You should do all the HTTP communication in an AsyncTask or another non-UI thread to keep the UI responsive. Displaying a progress dialog, even an indeterminate, would be a nice way of showing to the user that something is going on.

    Now, for your specific question. I would suggest creating a JSON array of your Strings to check. This will essentially give you one String containing all the data. Set this string as the value for a NameValuePair with whatever name you want and pass this NameValuePair as the HTTP Post entity to your server. Then in your PHP, you can simply do: $valuesToCheck = json_decode($_POST['name']) – and you’ll have an array in your $valuesToCheck variable.

    Now you can do whatever you need to do in PHP and get your data in PHP, for example, you can end up with an array of arrays, say $dataToSend would be an array where each element would be the result of calling mysql_fetch_assoc – or any other way. Once you have this data, simply do this in PHP:

    header("Content-type: text/json");
    echo json_encode($dataToSend);
    

    This will send all your data back to your calling code (Android in this case). Finally, in Android, get the response and JSON-decoded it. If you got back an empty array, then there were no matches in the database. If the array is not empty, then you got your data and do whatever you need with it.

    There are plenty blogs/tutorials/etc. on the web about encoding/decoding JSON in Android. For example, you can refer to this one.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am using jsonparser to parse data and images obtained from json response. When
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a text area in my form which accepts all possible characters from
I have been unable to fix a problem with Java Unicode and encoding. The
I have a view passing on information from a database: def serve_article(request, id): served_article

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.