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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:06:43+00:00 2026-06-05T21:06:43+00:00

I get the No Items found toast on the ListActivity. Note: When I change

  • 0

I get the “No Items found” toast on the ListActivity.

Note: When I change the PHP code to “Select * from items”, the entire table shows up. But when I try to filter it with the param/cat_id value in Android/Java, I get a blank

Here is code, first: php

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

(I have confirmed that “cat_id”, the value I am passing into the below activity through a bundle is what it needs to be.)

Android/Java:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    cat_id = getIntent().getExtras().getString("category_id");
    items = new ArrayList<String>();

    new task().execute();

}

 class task extends AsyncTask<String, String, Void> {

    @Override
    protected Void doInBackground(String... params) {
        String url_select = "http://www.---.com/---/items.php";

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

        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url_select);

        try {
            httpPost.setEntity(new UrlEncodedFormEntity(param));

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();

            // read content
            is = httpEntity.getContent();

        } catch (Exception e) {

         //

        }

and farther below

    protected void onPostExecute(Void v) {

        String item;
        try {
            jArray = new JSONArray(result);
            JSONObject json_data = null;
            for (int i = 0; i < jArray.length(); i++) {
                json_data = jArray.getJSONObject(i);
                item = json_data.getString("item");

                items.add(item);
            }
        } catch (JSONException e1) {
            Toast.makeText(getBaseContext(), "No Items Found",
                    Toast.LENGTH_LONG).show();
        } catch (ParseException e1) {
            e1.printStackTrace();
        }

I get the “No Items found” toast on the ListActivity.

Note: When I change the PHP code to “Select * from items”, the entire table shows up. But when I try to filter it with the param/cat_id value in Android/Java, I get a blank.

  • 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-05T21:06:46+00:00Added an answer on June 5, 2026 at 9:06 pm

    On the Java code you write

     param.add(new BasicNameValuePair("category_id", cat_id));
    

    but on the PHP code you write

    $_REQUEST['cat_id']
    

    you should change it to

    $_REQUEST['category_id']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get items from a html list from the vb.net code behind
i need to get items from a List with no leading or trailing white
I have a SPList object and use SPList.Items to get the SPListItemCollection. From this
I found another question on here that told how to get the matching items
I need get all items these have no categories int? categoryId = null; var
Suppose I have public class Product: Entity { public IList<Item> Items { get; set;
How to get ItemsControl display items selected Item textbox text value using MVVM pattern?
I am trying to get the selected items string out of a Spinner .
I have a div that is position: absolute and it contains items that get
The below code works fine in Win XP til determine the WLAN Card, but

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.