Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Füllen eines Kalenders mit PHP-Foreach-Code

Das sollte es tun:

$dates = array();

// build an array with that data
foreach($events as $event)
  $dates[] = (object)array(
     'date'  => date('Y/m/d'),
     'title' => $event->title,
     'desc'  => sprintf('<a href="%s/index.php/events/get_event?id=%s">Details/Signups</a>', SITE_URL, $event->id),
  );

?>

eventdates:

<?php print json_encode($dates); // print it as a json string ?>