Jump to content

Problem json_encode($results) with data like  


Danny620

Recommended Posts

	

function Pretty_JSON($json){ 

$pattern = array(',"', '{', '}');
	$replacement = array(",\n\t\"", "{\n\t", "\n}");

return str_replace($pattern, $replacement, $json);

}

$blogs[] = array(
      		'blog_id' => ($row['ID']),
     	    'post_date' => ($row['pd']),
		'post_title' => (html_entity_decode($row['post_title'], ENT_QUOTES)),
		'blog_img' => ('http://www.socialnewsoffice.com/uploads/'.$row['article_img']),
		'post_content' => (html_entity_decode($row['post_content'], ENT_QUOTES)),
		'tags' => ($row['tags']),
		'views' => ($row['views']),
		'categorie_id' => ($row['categorie_id']),
		'post_url' => ($row['post_url']));
    }

	$results[] = array(
		'data' => ($blogs),
		'start' => ("$start"),
		'pages' => ("$pages"),
		'display' => ("$display"));

	echo $json = Pretty_JSON(json_encode($results));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.