Javascript 在离子视图上重复数据?
数据库:Javascript 在离子视图上重复数据?,javascript,html,json,angularjs,ionic,Javascript,Html,Json,Angularjs,Ionic,数据库: `--> product table id name cid uploadKey 1 Cemera 1 7365 2 Notebook 2 7222` `--> category table id catename 1 canon 2 toshiba` `--> attactments table id uploadKey filepath 1
`--> product table
id name cid uploadKey
1 Cemera 1 7365
2 Notebook 2 7222`
`--> category table
id catename
1 canon
2 toshiba`
`--> attactments table
id uploadKey filepath
1 7365 /img/jdf.png
2 7365 /img/sdsd.jpg`
此代码用于创建json文件:
$_GET['id']="1";
$json_response = array();
if(isset($_GET['id']))
{
$id=$_GET['id'];
$select = mysql_query("SELECT product.name,category.catename,attactments.filepath FROM product INNER JOIN category ON category.id = product.cid INNER JOIN attactments ON attactments.uploadKey = product.uploadKey where product.id='".$id."' ");
while ($row = mysql_fetch_array($select , MYSQL_ASSOC)) {
$json_response[] = $row;
}
}
echo $val= str_replace('\\/', '/', json_encode($json_response));
结果重复信息,如何删除重复我想显示如下:
[{"name":"Cemera","catename":"canon","filepath":"/img/jdf.png"},{"name":"Cemera","catename":"canon","filepath":"/img/sdsd.jpg"}]
代码显示详细信息:
<ion-view>
<ion-content>
<ion-list class="list-inset">
<ion-item class="item-text-wrap" ng-repeat="x in detail ">
<p> Name : {{x.name}}</p>
<p> Category : {{x.catename}}</p>
<p> Filepath : {{x.filepath}}</p>
<p> </p>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
为什么你要按名称和类别发送所有数据组并从服务器发送如果你不能在服务器端进行分组,就试试这个角度过滤器我不知道怎么做,你能给你链接吗阅读它你不能给我一个简单的指导方法吗
Name: Cemera
Category : canon
Filepath : /img/jdf.png
/img/sdsd.jpg`