有人可以帮我解决这个错误吗?

时间:2016-03-22 08:12:35

标签: javascript php html css

我有这个错误,我不知道那是什么错误,我是新手。提前谢谢。

语法错误,意外的'','' (T_CONSTANT_ENCAPSED_STRING),期待','或';'

<?php
$qry = "SELECT tbl_input.* FROM tbl_input";
$result = mysql_query($qry);
?>

    $(document).ready(function() {

        $('#calendar').fullCalendar({
            defaultDate: '2016-01-12',
            editable: true,
            eventLimit: true, // allow "more" link when too many events
            events: 
            [
            <?php
            while ($qry = mysql_fetch_array($result))
            {
                $date = $qry['m_date'];
                $name = $qry['comp_name'];
                $id = $qry['id'];

                $end = new DateTime($schedule);
                $Edate = date_format($end, "d");
                $Emonth = date_format($end, "n");
                $Eyear = date_format($end, "Y");
                $emonth = $Emonth - 1;

在这一行的某个地方我有一个错误:

                echo'
                {
                    title: "'. $name . '",
                    start: new Date('.$Eyear.', '.$emonth', '.$Edate.')
                },
                ';
            }
            ?>
            ]
        });

    });

</script>
</head>

    <div id='calendar'></div>
<?php
include('./inc/footer.inc')
?>

1 个答案:

答案 0 :(得分:2)

您错过了.

中的$emonth

更改

start: new Date('.$Eyear.', '.$emonth', '.$Edate.')

 start: new Date('.$Eyear.', '.$emonth.', '.$Edate.')