<?php

//load.php

$connect = new PDO('mysql:host=localhost;dbname=plcollage_gyogyt;charset=utf8mb4', 'plcollage_root', '#Ef5IQ)%15+*');

$data = array();

$query = "SELECT * FROM events ORDER BY id";

$statement = $connect->prepare($query);

$statement->execute();

$result = $statement->fetchAll();

foreach($result as $row)
{
 $data[] = array(
  'id'   => $row["id"],
  'title'   => $row["title"],
  'start'   => $row["start_event"],
  'end'   => $row["end_event"]
 );
}

echo json_encode($data);

?>
