Hope someone can help me. Im trying to integrate Fullcalendar (jQuery) to my website. Its version 1.6.4.
I allready have a database with content I would like to add to the calendar. I my database the raws have the names: - dispalydate (a given date for the event given in the format 2014-03-23. It should be displayed that date) - Name (title of the event) - id (id in the database)
I can see that Fullcalendar use the below code (from the file json-events.php) to show something in the calender:
<?php
$year = date('Y');
$month = date('m');
echo json_encode(array(
array(
'id' => 111,
'title' => "Event1",
'start' => "$year-$month-10",
'url' => "http://yahoo.com/"
),
array(
'id' => 222,
'title' => "Event2",
'start' => "$year-$month-20",
'end' => "$year-$month-22",
'url' => "http://yahoo.com/"
)
));
?>
I have replaced the above code with my own code below. I have connection to the database but nothing is showed in the Fullcalendar
<?php
// Create connection
$con=mysqli_connect("localhost","*****","*****","*****");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
session_start();
$result = mysql_query("SELECT id, name, displaydate AS displaydate FROM caledar");
mysql_close();
$events = array();
while ($row=mysql_fetch_array($result)){
$id = $row['id'];
$title = $row['name'];
$start = $row['displaydate'];
$events = array(
'id' => "$id",
'name' => "$title",
'displaydate' => "$start"
);
}
echo json_encode($events);
?>
Can someone advice or see what om doing wrong?