这是我的php代码
$query=mysql_query("SELECT * FROM product");
$bla = array();
$numOfRows= mysql_num_rows($query);
if ($numOfRows >0)
{ while ($rows=mysql_fetch_array($query,MYSQL_ASSOC))
{
//$productID=$rows["id"];
$bla[]=$rows;
//echo '<p class="image"><img style="border: " src="images/'.$productID.'.jpg" width="154" height="137"/></p>';
echo json_encode($bla);
}
}
输出结果如下
[{"id":"2","title":"iPhone 5","price":"500","category":"Mobile","description":"APPLE","date_added":"0000- 00-00 00:00:00","date_update":"0000-00-00"}]
[{"id":"2","title":"iPhone 5","price":"500","category":"Mobile","description":"APPLE","date_added":"0000- 00-00 00:00:00","date_update":"0000-00-00"}, {"id":"41","title":"samsung S3","price":"100","类别":"手机","描述":"asda","date_added":"2013-03-10 21:43:12","date_update":"2013-03-10"}]
如您所见,产品 id 2 重复。我怎样才能删除这个?我只想显示第二个数组!!在我的数据库系统中,我没有重复的数据,我不知道这是从哪里来的,请帮忙