Search
 
SCRIPT & CODE EXAMPLE
 

PHP

javascript php loop

<?php
$s=array('a','b','c','d','e','f');
$s_to_json=json_encode((array)$s);
?>

<script type="text/javascript">

var fromPHP=<? echo $s_to_json ?>;

for (i=0; i<fromPHP.length; i++) {

yourValue=fromPHP[i];

}

</script>
Comment

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>
Comment

PREVIOUS NEXT
Code Example
Php :: get image field in custom post type category taxonomy 
Php :: php get last 3 elements of array 
Php :: install php-mysql 
Php :: php password_hash 
Php :: laravel crud application 
Php :: php is closure 
Php :: Laravel factory creating tempory data 
Php :: hash php 
Php :: php interview questions for 2 year experience 
Php :: php exceptions 
Php :: socket io laravel 
Php :: displaying dates using php code 
Php :: randhex php 
Php :: get from link php 
Php :: loop through objects in php 
Php :: how do i use php read excel file 
Php :: create an email addresses php 
Php :: @can in laravel 
Php :: Basic HTTP Authentication example 
Php :: php print number 
Php :: php numeric array 
Php :: laravel debugbar ServiceProvider to the providers 
Php :: route group laravel 8 
Php :: php save array to files a 
Php :: undefined index / error reporting in php 
Php :: type declaration php 
Php :: php check if variable is resource 
Php :: how i can send by database table in laravel full calendar 
Php :: mysqli_query() expects parameter 1 to be mysqli 
Php :: laravel request 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =