拜託各位幫我解決這個錯誤: 我因該已經轉型態了會甚麼還會有錯誤
package com.example.wells.ndr_text;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class DBphp {
private static HttpClient hC;
private static HttpPost hP;
public static String DBstring(String i,String Wcook,String url){
String result="錯誤";
try{
hC=new DefaultHttpClient();
hP=new HttpPost(url+"/index.php");
hP.addHeader("Cookie",Wcook+";expires=thu,31-Dec-37 23:55:22 GHT; path=/");
ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("S1",i));
hP.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
HttpResponse hR=hC.execute(hP);
HttpEntity hE=hR.getEntity();
InputStream inputStream=hE.getContent();
BufferedReader bufReader=new BufferedReader(new InputStreamReader(inputStream,HTTP.UTF_8),8);
StringBuilder builder =new StringBuilder();
String line=null;
while((line = bufReader.readLine())!=null){
builder.append(line+"\n");
}
inputStream.close();
result=builder.toString();
}catch (Exception e){
result=e.toString();
}finally {
hC.getConnectionManager().shutdown();
}
return result;
}
}
php
index
<?php
require_once("SQL_data.php");
$insertSQL=isset($_POST["S1"])<>NULL?$_POST["S1"]:"select * from user";
mysql_select_db($database,$GD);
$Result=mysql_query($insertSQL,$GD) or die(mysql_error());
while($r = mysql_fetch_assoc($Result))
$output[]=$r;
print(json_encode($output,JSON_UNESCAPED_UNICODE)); //中文不轉成unicode碼
mysql_close();
?>
SQL_data
<?php
$hostname="------";
$username="------";
$password="-------";
$database="-------";
$GD=mysql_pconnect($hostname,$username,$password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("SET NAMES UTF8");
mysql_query("SET CHARACTER_SET_CLTENT='utf8'");
mysql_query("SET CHARACTER_SET_RESULTS='utf8'");
?>