将android连接到mysql数据库

将android连接到mysql数据库,android,mysql,Android,Mysql,我一直在尝试这个教程。它没有显示任何错误,但在emulator上只显示我提供的url 我的连接字符串是: public static final String KEY_121 = "http://10.0.2.2/index.php"; (我在本地主机上工作时使用了10.0.2.2) 当我查看日志时,它显示了dis: error parsing data org.json.JsonException: Value <br of type java.lang.String cannot b

我一直在尝试这个教程。它没有显示任何错误,但在emulator上只显示我提供的url

我的连接字符串是:

public static final String KEY_121 = "http://10.0.2.2/index.php";
(我在本地主机上工作时使用了10.0.2.2)

当我查看日志时,它显示了dis:

error parsing data org.json.JsonException: Value <br of type java.lang.String cannot be converted to JSONArray
这是我在IE上键入“”时显示的内容


尝试打印从服务器获得的输出。返回的JSON似乎不清楚。这部分

Value <br of type 

Value修复php警告,index.php的结果应该是有效的JSON响应


变量
$\u REQUEST['year']
未定义,可能是因为您没有将其与请求一起发送。您的变量
nameValuePairs
从未添加到您的请求中…

服务器可能返回一个以开头的错误

<BR />
然后运行程序并检查日志。它将显示从服务器接收到的信息


例如,如果您的PHP配置不包括JSON库,您将得到一个错误。您可能正在使用旧版本的PHP。如果您使用的是托管服务器,如1和1或GoDaddy,您可能只需要编辑.htaccess文件,以便您的站点使用PHP5。

您好,非常感谢您的帮助。我不熟悉php和mysql。你能告诉我发送请求需要做什么吗?
CREATE TABLE people (

  id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,

  name VARCHAR( 100 ) NOT NULL ,

  sex BOOL NOT NULL DEFAULT '1',

  birthyear INT NOT NULL

  )
Value <br of type 
<BR />
try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");

            /////////////////////////////////
            // ADD THIS
            Log.i("log_tag","Line reads: " + line);

        }
        is.close();
        result = sb.toString();
    } catch (Exception e) {
        Log.e("log_tag", "Error converting result " + e.toString());
    }