I’m trying to follow this tutorial in order to connect to an external database with android:
http://www.helloandroid.com/tutorials/connecting-mysql-database
However, I seem to receive two different errors when viewing the php / mysql connection code directly
and through logcat.
If I look at it through a browser, it comes up with the orange php error saying:
Undefined index: year
Found on line 6 with .$_REQUEST['year'].
If i debug the app and look at the logcat output, it seems to give a half error:
E/log_tag ( 403): Error parsing data org.json.JSONException: A JSONArray text m
ust start with '[' at character 6 of
On the php page, below the error, Json prints off the tables correctly, and echoing mysql errors are fine.
Can anyone help with the implementation of this function $_REQUEST please? (If that is the problem.)
Your output comes from the http request must be a well formed json string.
Obviously a PHP error like an Undefined index can break the json string and makes it unparsable by java.
You need to rid off the notice, for istance:
BTW
$_REQUESTis not a function. Is a superglobal associative array where all request variables (GET/POST/COOKIE) are stored.