1
我有這種情況與PHP(PDO);我正在實現一種方法,從MySql中檢索數據,並做得很好,但問題是重複數據恢復爲關鍵骨骼,因爲沒有值,但其他數據附加更多,離開腳本和圖像的更多細節;PHP PDO檢索重複數據
Data.php
//read
public function getData() {
$statement = $this->db->prepare("select Id,Company_Name,Contact_Name,Contact_Title,Address from contact_details LIMIT 3;");
$statement->execute();
if ($statement->rowCount() > 0) {
$value = $statement->fetchAll();
return $value;
}
}
可變檢查
JSON重複
預期的結果
Data: [{"Id":"1","Company_Name":"Romero y tomillo","Contact_Name":"Alejandra Camino","Contact_Title":"Accounting Manager","Address":null}
,{"Id":"2","Company_Name":"Morgenstern Gesundkost","Contact_Name":"Alexander Feuer","Contact_Title":"Marketing Assistant","Address":"Heerstr. 22"}
,{"Id":"3","Company_Name":"Ana Trujillo Emparedados y helados","Contact_Name":"Ana Trujillo","Contact_Title":"Owner","Address":null}]
它工作正常,但只返回一個對象,應該從恢復中返回三個對象,並選擇 – MauricioHz
我不知道您對該評論的含義。我用一些代碼示例編輯了答案 – Pinoniq