这是输出:
[
{
"0": "1",
"cat_id": "1",
"1": "Hello World!",
"post_title": "Hello World!",
"2": "1296943703",
"post_date": "1296943703",
"3": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
"post_content": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
}
]正如你可能看到的那样,重复的记录被添加到一个整数中,并且行的名字是这样的:
// SQL statement and mysql_query
$posts = array();
while($row = mysql_fetch_array($result))
{
$posts[] = $row;
}
mysql_free_result($result);
die(json_encode($posts));你如何让它不重复两次,只显示行名和记录。