0
AngularJS 프레임 워크에 대한 ngInfiniteScroll 종속성입니다. https://sroze.github.io/ngInfiniteScroll/무한 스크롤 행이 중복됩니다.
내 테이블에 할당되어 있습니다.
<table infinite-scroll="loadMore()" ng-controller="LastBookingsCtrl">
내 javascript 파일의 loadMore 함수는 다음과 같습니다.
$scope.loadMore = function() {
$http.get("last.php?start=" + $scope.currentLoadIndex)
.then(function (res) {
if (res.data.length > 0) {
var count = 0;
for (var i = 0; i < res.data.length; i++) {
$scope.lastBookings.push(res.data[i]);
count++;
}
$scope.currentLoadIndex += count;
}
});
};
와 나는 load.php
내 MySQL의 쿼리가 올바른 생각,하지만 난 모르겠어요.
$start = $_GET['start'];
$query = "SELECT * FROM `performs` ORDER BY id DESC LIMIT ".$start.", 20";
가변 개수에서 내 mysql 시작부터 20 행을 제공합니다.
하지만 위아래로 스크롤 할 때마다 어떻게 든 복제됩니다.
약간 관련이없는,하지만 https://stackoverflow.com/questions/60174/how-can-i을 숙지하시기 바랍니다 -prevent-sql-injection-in-php – Skwal
해결되었습니다. 게시 해 주셔서 죄송합니다. 삭제할 수 있습니다. – enucar
@enucar 공유하는 데 문제가 있다면 무엇을 했습니까? 누군가에게 도움이 될 수 있습니다. 또한 언급 된 Skwal과 같은 SQL 인젝션에 대한 쿼리 보안을 고려해야합니다. –