각도 및 PHP 프로젝트를 구축 중입니다. 내 데이터베이스에 "고객"테이블이 있습니다. 드롭리스트의 "Customers"테이블에서 모든 이름을 가져 오려고하는데 작동하지 않습니다. 현재 콘솔에 오류가 표시되지 않습니다. 누구든지 내 코드를 확인해 주시겠습니까?각도 및 PHP를 사용하여 드롭 목록으로 데이터를 가져올 수 없습니다.
HTML :
<select>
<option ng-repeat="x in customersDetails track by $index" value="{{x.customer_id}}" {{x.full_name}}</option>
</select>
</div>
컨트롤러 :
"use strict";
angular.module('dataSystem').controller('priceOfferCtrl', function($scope,$route,$location,$http)
{
$http({method:'GET', url:'api/customers-tab/get-priceOffer.php/'})
.success(function(response) {
$scope.customersDetails = response;
})
// This will log you the error code and trace, if there is an error.
.catch(function(err) {
console.log('err', err)
});
});
빌
<?php
header('Content-Type: text/html; charset=utf-8');
$connection = mysqli_connect('localhost','root','','hamatkin');
mysqli_query($connection,"SET character_set_client = utf8");
mysqli_query($connection,"SET character_set_connection = utf8");
mysqli_query($connection,"SET character_set_results = utf8");
if(!$connection){
die("couldnt connect".mysqli_error);
}
$customer = new Customer();
$query = "SELECT * FROM `customers``";
$queryResult = $connection->query($query);
$queryResult2 = array();
if($queryResult->num_rows>0){
while($row = $queryResult->fetch_assoc()){
$customer->customer_id = $row['customer_id']
$customer->full_name =$row['full_name']
}
}
header('Content-type:application/json');
$queryResult3 = json_encode($queryResult2);
echo json_encode($queryResult3);
?>
= 배열 (); 그때? –
@ B.Kocaman 나는 내가 어떻게해야할까요? – tanyaa