2012-11-30 4 views
0

경고 로그 캣 PHP로, 나는 로그 캣에서 이러한 노란색 경고를 얻을 : SingleClientConnManager의보내는 데이터는

잘못된 사용 : 여전히 할당 된 연결을

과 :

W/SingleClientConnManager (274) : 다른 하나를 할당하기 전에 연결을 해제해야합니다. 이 같은

내 코드 :

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); 
nameValuePairs.add(new BasicNameValuePair("email", "")); 
    InputStream is=null; 
    try { 
     HttpClient httpclient = new DefaultHttpClient(); 
     HttpPost httppost = new HttpPost("http://zzzzz.com/zzz.php"); 
     httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 
     httpclient.execute(httppost); 
     HttpResponse response = httpclient.execute(httppost); 
     HttpEntity entity = response.getEntity(); 
     is=entity.getContent(); 

    } catch (IOException e) { 
    } 

그리고 내 zzz.php에서

나는이 : 그런데

<?php 

$email = "aaa"; 

if (session_id() == "") 
{ 
    session_start(); 
} 
if (!isset($_SESSION['username'])) 
{ 
    header('Location: ./index.php'); 
    exit; 
} 
else 
{ 

$username = "******"; 
$password = "****"; 
$host = "****"; 
$database = "****"; 

$db = mysql_connect($host, $username, $password); 
if (!$db) 
    { 
    die('Failed to connect to database server!<br>'.mysql_error()); 
    } 
else 
    { 
    mysql_select_db($database, $db) or die('Failed to select database<br>'.mysql_error()); 
    mysql_query("UPDATE Users SET lat='".$email."' WHERE username='{$_SESSION['username']}'"); 
    } 
} 
?> 

, 내가는 mysql_query가되지 알고, 내가 그것을 변경할 수 있습니다. 코드 위의 아무튼 작동하지 않습니다. 나는 mysql에서 lat 값에 "aaa"를 쓰지 않는다는 것을 의미한다. 어디가 잘못 됐니?

답변

0

$ _SESSION [ 'username']은 (는) 언제든지 설정되지 않은 것처럼 보입니다.

+0

브라우저로 노트북에 연결할 경우 error.It가 작동하지 않습니다.하지만 내 Android 휴대 전화와 연결하면 logcat에 경고가 표시됩니다. – Ozan

0

두 줄이 모두 필요합니까?

httpclient.execute(httppost); 
HttpResponse response = httpclient.execute(httppost); 
+0

죄송합니다. 저는 이것을 알고 있습니다. 내 프로젝트에 사용자 지정 웹 클라이언트를 사용하고 WebChromeClient를 확장합니다. 그래서이 줄은 ** HttpClient httpclient = new DefaultHttpClient(); **는 여전히 사용자 지정 클라이언트에서 작동합니까? – Ozan