私はfullcalendar、PHP、angularjsを使用してmysql dbからカレンダーイベントを取得しようとしています。AngularJS FullCalendar IDでイベントを取得
HTTP
<div ng-controller="calController" ng-show="tab4">
<div id="calendar" ui-calendar="uiConfig.calendar" ng-model="eventSources" calendar="myCalendar">
</div>
</div>
マイconroller:
.controller('calController', ['$rootScope', '$scope', '$http', 'uiCalendarConfig', function ($rootScope, $scope, $http, uiCalendarConfig) {
var user = $rootScope.userID;
$scope.eventSources = {
url: 'php/events.php?agentID=' + user
};
$scope.uiConfig = {
calendar: {
height: 300,
editable: false,
allDay: false,
header: {
left: 'title',
center: '',
right: 'agendaWeek prev,next'
}
}
};}]);
マイPHP:DBでの私のカレンダーに結果が、彼らはすべての結果を得る
$sql="SELECT * FROM `Events`";$sql = $con->prepare($sql);$sql->execute();$results=$sql->fetchAll(PDO::FETCH_ASSOC); $json=json_encode($results);
イム。おそらくstatemntがselect * from events...
であると思われます。コントローラーでは、パラメータ "user"を使用してURLを渡していますが、これはPHPスクリプトの返信には影響しません。
私の質問はどのように特定のユーザーイベントだけを返し、すべてのイベントを返すのですか?
EDIT ..私は私のPHPファイルを編集する必要が推測するが、私は何をすべきかを知らない:
アイブ氏はまた、配列にイベントを取得し、その後eventSourcesへの結合を試みた:
これはIDを使用してイベントを取得するのに効果的ですが、今はカレンダーにイベントが表示されません。
console.log("events", events);
console.log("sources", $scope.eventSources);
上記の出力がある:
wouldntのイベントは、アレイとカレンダ中に示すことがなぜですか?どんな助けも素晴らしいだろう。トラブルシューティングのビットで
おかげ
は、バッククォートを使用する代わりに、テーブル名を形成します – Saty