bootstrap-calendar
bootstrap-calendar copied to clipboard
php json not working
He Everyone,
my php-json-result is not working...pls help:
<?php
//Get all Dates from Database
//Getting Databaseobject
require_once '../model/class.dbmod.inc.php';
$dbmod = new dbmod();
//$start = $_REQUEST['from'];
//$end = $_REQUEST['to'];
//Get Events for the Area
//$events = $dbmod->getEvents($start, $end);
$events = $dbmod->getEvents();
$out = array();
$counter = 0;
while($row = $events->fetch()) {
$out[$counter] = array(
'id' => $row['id'],
'title' => $row['title'],
'url' => $row['d_short'],
'class'=> "event-important",
'start' => $row['d_start'],
'end' => $row['d_end']
);
$counter++;
}
echo json_encode(array('success' => 1, 'result' => $out));
exit;
?>
Here Calendar:
var calendar = $('#calendar').calendar({
language: 'de-DE',
events_source: 'app/endpoint/returndates.php',
tmpl_path: "assets/tmpls/",
modal: "#events-modal",
view: "week"
});
String as "echo" from php-File: {"success":1,"result":[{"id":"1","title":"Und wieder einer","url":"tralala","class":"event-important","start":"1456300800000","end":"1456304400000"}]}
Links are working - i get no errors...thx4help!
Try change $out[$counter] = array(
to $out[] = array(
.