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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:59:41+00:00 2026-05-25T23:59:41+00:00

I am using Android to create a app. Where user answer are store on

  • 0

I am using Android to create a app. Where user answer are store on mySQL on server via PHP code.

function fetch_all_complaints_by_packet($packet) {
    global $dBConnection;

    $query = "SELECT * FROM ".DB_PREFIX ."complaint ORDER BY id DESC LIMIT 0 , 10";
    $result = mysql_query($query,$dBConnection) or die('Errant query:  '.$query);

    $complaints = array();

    if(mysql_num_rows($result)) {
        $i = 0;

        while($complaint = mysql_fetch_assoc($result)) {
            $complaints[$i] = $complaint;
            echo ($complaint['details'].'<br>');
            $i++;
        }
    }

    //echo json_encode($complaints);
}

The following line

echo json_encode();

Cause error it show details as NULL, but

echo json_encode($complaint['details'].'<br>');

Print the correct data. What the problem is?

  • 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-25T23:59:42+00:00Added an answer on May 25, 2026 at 11:59 pm

    I’ve had something similar to this maybe check on your side if the problem is the same:

    When you have an invalid UTF-8 string (invalid utf-8 characters) and try to JSON_Encode that data, it will return NULL.

    It took me hours to find that in my code because after all it is AJAX call so you can’t really see the errors coming out.

    My suggestion is to turn error logging on and display all errors, you will probably see an error about UTF-8 encoding that failed. If not, try to utf8_decode your data and see if it shoots out the error i told you about.

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

Sidebar

Related Questions

I'm making an Android app where the user can download files from a FTP-server.
Is it possible to create android app to find map location using Mobile Number.
I'm new in creating android app using eclipse. I am planning to create an
My Android app need the user to create an account to be able to
In my app, I store the user's app data using MySQLite databases, and I
In Android, I have some code to check whether the user has GPS switched
I'm trying to create an Android app that searches for a certain type of
I'm working on creating a checkbook app for android using a database to record
I have developing an App where the user can create event and set notification
I have a Python App Engine application where a user can log in using

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.