Integrating jQuery fullcalendar into PHP website

前端 未结 11 885
夕颜
夕颜 2021-02-01 09:28

I would like to integrate the jQuery fullcalendar into my PHP website, but I don\'t know how to handle the event and how to use the JSON data from MySQL.

Any advice wou

11条回答
  •  太阳男子
    2021-02-01 10:18

    This example works:

    $sql= "SELECT id, title, start, DATE_FORMAT(start, '%Y-%m-%dT%H:%i' ) AS startDate
    FROM kalender
    ORDER BY startDate DESC";
    $res = mysql_db_query($db, $sql, $conn) or die(mysql_error());
    
    $events = array();
    //important ! $start = "2010-05-10T08:30";  iso8601 format !!
    while ($row = mysql_fetch_assoc($res)) {
       $eventArray['id'] = $row['id'];
       $eventArray['title'] =  $row['title'];
       $eventArray['start'] = $row['startDate'];
       $events[] = $eventArray;
    }
    echo json_encode($events);
    

提交回复
热议问题