向php发送参数时出错

向php发送参数时出错,php,android,Php,Android,在将android连接到php时,有时不发送参数 user=i.getExtras().getString("user"); params.add(new BasicNameValuePair("user",user)); // getting JSON string from URL json = jParser.makeHttpRequest(url_orders, "GET", params); 基于空用户获得的结果 这对我很管用,试试这个: 谢谢亲爱的,我正在使用相同的代码。我使用了a

在将android连接到php时,有时不发送参数

user=i.getExtras().getString("user");
params.add(new BasicNameValuePair("user",user));
// getting JSON string from URL
json = jParser.makeHttpRequest(url_orders, "GET", params);
基于空用户获得的结果

这对我很管用,试试这个:


谢谢亲爱的,我正在使用相同的代码。我使用了androidhive教程。我正在使用wamp服务器。问题是:当我运行移动应用程序并显示订单(给定用户的订单-用户为param-)时,订单显示正确。如果重新运行同一活动,它有时会显示空列表。因为关联的php脚本测试了_GET('user'),发现它是空的。我的问题是:问题是来自wamp服务器还是来自移动应用程序?需要进行一些配置吗?plz帮助,我建议查看日志:1。数据从android到php脚本和2。数据显示到php脚本。如果您有时获取数据,那么您的代码中肯定有一些编程错误//从URL JSON=jParser.makeHttpRequest获取JSON字符串(URL\u orders\u details,“GET”,params);尝试{//检查成功标记int SUCCESS=json.getInt(TAG_SUCCESS);if(SUCCESS==1){//logcat.setText(json.toString());//找到的产品//获取产品订单详细信息数组=json.getJSONArray(TAG_ORDERS_DETAILS);//遍历所有产品以获取(int i=0;ivalue-map.put(TAG_-PRODUCT,PRODUCT);map.put(TAG_-QTY,QTY);//将HashList添加到ArrayList-ordersDetailsList.add(map);}else{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://URL.com.php");
postParameters.add(new BasicNameValuePair("param1", value1));
postParameters.add(new BasicNameValuePair("param2", value2));
httppost.setEntity(new UrlEncodedFormEntity(postParameters));
HttpResponse response = httpclient.execute(httppost);
String str = inputStreamToString(response.getEntity().getContent())  
            .toString()