What im doing wrong here? I`m trying to select an event by id, here is 1 by default just for testing purposes.
Calendar events POST
$(document).ready(function()
{
var utilizador =1;
var calendar = $('#calendar').fullCalendar({
editable:true,
header:{
left:'prev,next today',
center:'title',
right:'month,agendaWeek,agendaDay'
},
events:
{
url:'../Components/calendar/load.php',
type: 'POST',
data: function() {
return {
id: utilizador
};
}
},
....
My Load.php where i try to select the id i got before
<?php
//load.php
if(isset($_POST["id"]))
{
$connect = new PDO('mysql:host=localhost;dbname=novamente', 'root', '');
$data = array();
$query = "
SELECT * FROM consulta ORDER BY idconsulta WHERE utilizador=:id";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
foreach($result as $row)
{
$data[] = array(
'id' => $row["idconsulta"],
'title' => $row["local"],
'start' => $row["horainicio"],
'end' => $row["horafim"],
'utilizador' => $row["utilizador"]
);
}
echo json_encode($data);
}
?>
I know it will be a minor error but im just learning jquery and php. Thanks!