title: Unable to show events from MySQL in fullcalendar in Javascript using PHP JSON
body: <p>I am trying to retrieve data from MySQL and display in full calender in my Javascript code.</p>
  
  <p>Below is the code in my Javascript:</p>
  
  <pre><code>$('#calendar').fullCalendar({
  editable: true, 
  header: {
  left: 'prevYear,prev,next,nextYear today',
  center: 'title',
  right: 'month,agendaWeek,agendaDay'
  },
  slotMinutes: 30,
  allDaySlot: true,
  selectable: true,
  height: 580,
  minTime: 10,
  maxTime: 22,
  selectHelper: true,
  defaultview: 'week',
  events: {
      url: '.././pages/json-events.php',
      type: 'POST',
      error: function() {
          alert('There was an error while fetching events.'); // Error alert
      }
  },
  timeFormat: 'hh:mmtt',
  dayClick: function(date, allDay, jsEvent, view) {
  
  if (allDay) {
  alert('Clicked on the entire day: ' + date);
  }else{
      //var slotDate=date.getDate() +'/'+date.getMonth()+'/'+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes()
      //alert('Clicked on the slot: ' + slotDate);
      newappointment(date, allDay);
  }
  },
  
  eventClick: function(calEvent, jsEvent, view) {
      //alert('Event title: ' + calEvent.title +' ; Event start:' + calEvent.start);
      editappointment(calEvent);
  },
  </code></pre>
  
  <p>Below is my PHP code:</p>
  
  <pre><code>$con=mysqli_connect("server","user","pwd","db");
                  // Check connection
                  if (mysqli_connect_errno()) {
                    echo "Failed to connect to MySQL: " . mysqli_connect_error();
                  }
  
                  $result = mysqli_query($con,"SELECT * FROM table  ORDER BY appId");
  
              /*  while($row = mysqli_fetch_array($result)) {
                    echo $row['appid'] . " " . $row['title'];
                    echo "&lt;br&gt;";
                  }*/
  
                  mysqli_close($con);
  
                  // Returning array
                   $return_array = array();
                   // Event array
                   $event_array;
          while($row = mysqli_fetch_array($result)) {
          // while ($row = $sth-&gt;fetch(PDO::FETCH_ASSOC) {
              // Create a new array for the event
              $event_array = array();
              // Add data from database to the event array
              $event_array['id'] = $row['appId'];
              $event_array['title'] = $row['start'];;
              $event_array['start'] = new Date($row['startYear'],$row['startMonth'],$row['startDate'],$row['startHour'],$row['startMins']);
              $event_array['end'] = new Date($row['endYear'],$row['endMonth'],$row['endDate'],$row['endHour'],$row['endMins']);
              $event_array['allDay'] = false;
              // Merge the event array into the return array
              array_push($return_array, $event_array);
           }
           // Output the json feed as we need it to render the calendar
           echo json_encode($return_array);
      }
  </code></pre>
  
  <p>Every time the output come with the error message :</p>
  
  <blockquote>
    <p>"There was an error while fetching events."
    Which is specified in my Javascript.</p>
  </blockquote>
  
  <p>What am I doing wrong? </p>