如何显示动态PHP javascript日历

时间:2014-06-19 09:58:33

标签: javascript php mysql

下面是我从数据库表预订中获取日期的javascript代码,显然日历显示的是患者ID而不是名称和时间:数据库是mysqli如何让它显示行时间和名称以及把它变成一个链接

<script type="text/javascript">
        $(document).ready(function(){ 
    // CALENDAR
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next',
                center: 'title',
                right: 'month,basicWeek,basicDay'
            },
            editable: true,
            height: 550,
            events: [

                <?php 
                $sql2= mysqli_query($db_conn,"SELECT autoid,day,month,year,time,patientid as time FROM booking");

                while($row = mysqli_fetch_array($sql2))
                {
                $autoid = $row['autoid'];
                $day = $row['day'];
                $month = $row['month'];
                $year = $row['year'];
                $time = $row['time'];
                $patientid = $row['patientid'];

                $sql5="SELECT * FROM patients WHERE autoid='$patientid'";
                $result5=mysqli_query($db_conn,  $sql5);
                $row5 = mysqli_fetch_assoc($result5) ;
                $fname= $row5["fname"] ;
                $lname= $row5["lname"] ;    
               ?>
       { title: '<?php echo $lname;?>-<?php echo $time;?>', start: '<?php echo $year;?>, <?php echo $month;?>, <?php echo $day;?>', end: '<?php echo $year;?>, <?php echo $month;?>, <?php echo $day;?>', url: '#' }, 

      <?php
      }

      ?>
                {
                    title: 'Click for ThemeForest',
                    start: new Date(2030, m, 28),
                    end: new Date(2030, m, 29),
                    url: '#'
                }
            ]
        });
     });

    });
        </script>

1 个答案:

答案 0 :(得分:1)

您的查询中有一个拼写错误:...时间,随着时间的推移...... patientid是压倒一切的时间