0

I'm working with PHP, JSON, and Android to create mobile app that can retrieve data from MySQL database. I'm able to get all data from database but, when I try to get a specific data based on the user input I'm unable to get the data. I've try to discovered the solution through the google but I can't solve it. I got the following error from the logcat :

05-20 08:44:28.152: E/JSON Parser(313): Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject<br />
05-20 08:44:28.152: E/JSON Parser(313): <b>Warning</b>:  array_push() expects parameter 1 to be array, null given in <b>C:\xampp\htdocs\android\getSpesificName.php</b> on line <b>31</b><br />
05-20 08:44:28.152: E/JSON Parser(313): {"success":1,"mahasiswa":null}
05-20 08:44:28.152: D/Specific name(313): {"mahasiswa":[{"nama_mhs":"kurnianto"},{"nama_mhs":"amjad"},{"nama_mhs":"oki"},{"nama_mhs":"tes"},{"nama_mhs":"coba"},{"nama_mhs":"raditya"},{"nama_mhs":"edwin"}],"success":1}

This is my PHP code http://pastebin.com/dbUr5DZj JSONParser class http://pastebin.com/FYXsWyr4 Specific class http://pastebin.com/UkSdh3BN

Any help will be appreciate. Thanks.

1
  • Load your webservice in browser and check the response. Are you really getting JSON formatted response? Commented May 20, 2013 at 5:23

1 Answer 1

1

You have an error on line 29 of your PHP file. The line:

$respone["mahasiswa"] = array();

Should be:

$response["mahasiswa"] = array();
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much, I did not pay attention to the little thing like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.