MySQL数据进入FullCalendar

EDIT 2 I have the array at the correct format but nothing added to calendar:

enter image description here

EDIT

enter image description here

I want to get data from mysql and display it on fullcalendar. I have this PHP code:

<?php
//Set error reporting on
error_reporting(E_ALL);
ini_set("display_errors", 1);

//Include connection file
require_once('global.php');

//Json and PHP header
header('Content-Type: application/json');
$eventss = array();
$user = $_SESSION['username'];
$id_logged = $_SESSION['login_id'];

    $search_date = "SELECT * FROM appointment INNER JOIN patient ON appointment.patient_id = patient.id WHERE appointment.id_logged = :id_logged";
    $search_date_stmt = $conn->prepare($search_date);
    $search_date_stmt->bindValue(':id_logged', $id_logged);
    $search_date_stmt->execute();
    $search_date_stmt_fetch = $search_date_stmt->fetchAll();
    $search_date_stmt_count = $search_date_stmt->rowCount();

    foreach($search_date_stmt_fetch as $row)
    {
       $events[] = array( 'title' => $row['patient_name'], 'start' => date('Y-m-d',$row['date_app']), 'end' => date('Y-m-d',$row['date_app']), 'allDay' => false);
       array_push($events, $event);

    }

    echo json_encode($event);
?>

The array that should be returned to fullcalendar so it can display it should be like:

'id'=>'value', 'title'=>'my title', 'start'=>...etc

But what the array I am seeing in the XHR is like:

enter image description here

Here is fullcalendar script (no errors at the console):

    <script>
        (function ($) { 
            $(document).ready(function() {

              $('#calendar').fullCalendar({
                  eventSources: [

                    // your event source
                    {
                        url: 'fullcalendar/get-events.php',

                        error: function() {
                            alert('there was an error while fetching events!');
                        },
                        color: 'yellow',   // a non-ajax option
                        textColor: 'black' // a non-ajax option
                    }

                    // any other sources...

                ]
            });

          });
        })(jQuery);
    </script>

You are mixing $event, $events and $eventss (unused).

It should read :

foreach($search_date_stmt_fetch as $row) {
    $event = array( 'id' => $row['patient_id'], 'title' => $row['patient_name'], 'start' => date('Y-m-d',$row['date_app']), 'end' => date('Y-m-d',$row['date_app']), 'allDay' => false);
       array_push($events, $event);
}

echo json_encode($events);

I think you have problem with array you are using and you dont have ID for event, it supposee patient id to b I made some changes on your code please try it .

foreach($search_date_stmt_fetch as $row)
    {
       $event = array( 'id' => $row['patient_id'], 'title' => $row['patient_name'], 'start' => date('Y-m-d',strtotime($row['date_app'])), 'end' => date('Y-m-d',strtotime($row['date_app'])), 'allDay' => false);
       array_push($events, $event);

    }

    echo json_encode($events);

it depends on version of full calendar , there are two version v2 , v1

the required properties for the event object is title,start

if you are working with version v2, u need to convert the date to Moment, the version v2 is completely working on moment objects.

after getting the data from server, we can convert it like this

in js file:

$.map(data, function (me) {
              me.title = me.title, // this is required
              me.start = moment(me.start).format();  // this is required
              me.end = moment(me.end).format(); 
 }

 $('#calendar').fullCalendar('addEventSource', data);