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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:24:36+00:00 2026-06-06T01:24:36+00:00

In my Android: String cat_id = getIntent().getExtras().getString(category_id); ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair(cat_id,

  • 0

In my Android:

    String cat_id = getIntent().getExtras().getString("category_id");

    ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
    nameValuePairs.add(new BasicNameValuePair("cat_id", cat_id));

    try {
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(
                "http://www.---.com/items.php");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();
        is = entity.getContent();
    } catch (Exception e) {
        Log.e("log_tag", "Error in http connection" + e.toString());
    }

In my PHP:

// editing out DB connections which have been verified to work


 <?php
$sql=mysql_query("SELECT * FROM items WHERE cat_id = '".$_REQUEST['cat_id']."'");
while($row=mysql_fetch_assoc($sql))
    $output[]=$row;
print(json_encode($output));
mysql_close();
 ?>

So my issues is that It is returning nothing (in the JSON result part — a Toast says “No item is found”). Is my code correct, the way I am passing parameters from Android to PHP?

  • 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-06T01:24:37+00:00Added an answer on June 6, 2026 at 1:24 am

    I figured out what was and it was nobody’s fault for not answering.

    The issue started before Java passed on to PHP. It was a bundle that passed into the Java Activity in question. I had a simple mistake involving using an incorrect primitive which in turn caused a null to be passed in through a bundle.

    The null continued down the path and landed in the PHP part. So the code shown above is actually correct.

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

Sidebar

Related Questions

I am new in android and i print log-cat using: Log.w(Tag, String text); and
I made this little function: public String getDay() { String day = (String)android.text.format.DateFormat.format(E, new
I am new in android development.i want to add listview dynamically .i am able
final String [] tmp = new String[]{Android, Google}; ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(getApplicationContext(),android.R.layout.simple_expandable_list_item_1,tmp); final
I have a style applied to my whole application: AndroidManifest.xml: <application android:theme=@style/ApplicationStyle android:icon=@drawable/icon android:label=@string/app_name>
I have the following TextView in my XML layout file:- <TextView android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/autolink_test
My open-source Android application uses this in an SQL query: String.format(%f, someDoubleValue); Unfortunately, in
I know how to save string from EditTexts on android but my problem is:
I am using this code for on android just trying to convert string to
junit.framework.AssertionFailedError: Class com.android.deviceintelligence.test.Testshutdown has no public constructor TestCase(String name) or TestCase() at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at

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.