Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php loop in js

<script>
                                    
                                    <?php
                                        $eq = "SELECT * FROM events ORDER BY event_id desc";

                                        //store the result of the query in a variable called $result
                                        $resulteq=mysqli_query($connection, $eq);
                                        while($events=mysqli_fetch_assoc($resulteq)) { 
                                            
                                            $event_title = $events['event_title'];
                                            $start_time = $events['event_start_time'];
                                            $f_start_time = date_create($start_time);
                                            $event_start_time = date_format($f_start_time, 'c');?>

                                            calendar.addEvent({
                                                title: '<?=$event_title?>',
                                                start: '<?=$event_start_time?>',
                                                url: '../../../main/home.php',
                                            })
                                    <?php }?>
                                    
                                    calendar.render();
                                });
                            </script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #loop #js
ADD COMMENT
Topic
Name
9+1 =