title: Add events from database to fullcalendar
body: <p>I am using full calendar to display different type of events for my organization. All of the event are in a database and i use this php file to get the events.</p>
  
  <pre><code>&lt;?php
  $xml = array();
  // Create connection
  $conn = new mysqli('localhost', 'root', '');
  if(!$conn){
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);  
  }else{
    //echo "connection made";  
  }
  $db_selected = mysqli_select_db($conn, 'EventTracker');
  if(!$db_selected){
    die("database not selected");
  }else{
      $query="SELECT * FROM `events` WHERE `event_deletion` = 1";
      $result=mysqli_query($conn, $query);
      if(!$result){
          trigger_error("dbget: ".mysql_error()." in ".$query);
          return false;   
      }else{
          while($row =  mysqli_fetch_assoc($result)) {
              $obj = array();
              array_push($obj, $row['event_ID']);
              array_push($obj, $row['event_name']);
              array_push($obj, $row['event_start']);
              array_push($obj, $row['event_end']);
              array_push($xml, $obj);
              //print_r($xml);
          }
           generateXML($xml);
      }
  }
  //echo  json_encode($xml);
  function generateXML($array){
      $xmlString = "events:";
      for ($i = 0; $i &lt; sizeof($array);$i++){
          $obj = $array[$i];
          //print_r($obj);
          $set = "{
              id: '" . $obj[0] . "'," .
              "title:'" . $obj[1] . "'," .
              "start:'" . $obj[2] . "'," .
              "end:'" . $obj[3] . "'"."},";
              //echo $set . "\r\n";
          $xmlString = $xmlString . $set;
      }
      return $xmlString = $xmlString;
  }
  ?&gt; 
  </code></pre>
  
  <p>I am trying to load the string generated from generateXML to the jquery call for fullcalendar. </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var data = &lt;?php echo generateXML($xml); ?&gt;
  console.log(data)
  function getDates(){
      return data;    
  }
  $(document).ready(function() {
  
      // page is now ready, initialize the calendar...
  
      $('#calendar').fullCalendar({
          // put your options and callbacks here
          header: {
              left: 'prev,next today',
              center: 'title',
              right: 'month,basicWeek,basicDay'
          },
          //defaultDate: '2015-02-12',
          editable: false,
          eventLimit: true, // allow "more" link when too many events
          events: [getDates()],
      })
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Not sure what the problem is but any clues or suggestions would help.</p>