1
게시하기 전에 긴 검색을 수행했지만 해결 방법이 없습니다. JSON 및 PHP를 사용하여 Android 애플리케이션을 만들고 있습니다. 이제 PHPjsonencode가 빈 행을 추가하는 이유는 무엇입니까?
/**
*
LOT OF USELESS THING
*
*/
//Attributing values of $OUTPUT
$q=mysql_query($query);
if (!$q)
die(mysql_error()); // You'll be notified if there's any syntax error in your query.
$OUTPUT = array(array());
if ($q && @mysql_num_rows($q) > 0) {
// looping through all results
// products node
while([email protected]_fetch_assoc($q)){
if (!empty($e['title'])){
$u = Array();
$u['id'] = mb_convert_encoding($e['id'], 'UTF-8');
$u['title'] = mb_convert_encoding($e['title'], 'UTF-8');
$u['location_search_text'] = mb_convert_encoding($e['location_search_text'], 'UTF-8');
$OUTPUT[] = $u;}
//echo "<br>************<br>";*/
//$OUTPUT[] = $e;
}
}
print(json_encode($OUTPUT));
,이 JSON의 출력 :
당신이 볼 경우[[],{"id":"796","title":"ANSEJ ORAN \/Agence de Soutien \u00e0 l'Emploi des Jeunes d'Oran","locat ...etc
는, [사진]있다; -이
그러나 $OUTPUT = array();
내부에 빈 배열을 만들
Error parsing data org.json.JSONException: Value [] at 0 of type org.json.JSONArray cannot be converted to JSONObject
나는 당신의 대답과 함께 :) 감사합니다! –
당신은 환영합니다 :) – nospor