This is an old revision of the document!
<html> <script src=“https://code.jquery.com/jquery-2.2.0.min.js”></script>
<div id='liclass'> </div>
<?php require('db.php'); $dbh = get_db(); $person_list =
$dbh->query('select fullname, birthdate, country_code from person') ->fetch_all(MYSQLI_ASSOC);
echo format_html_table($person_list, 'persontable'); ?> /* <!– uebergabe der Daten mittels einer “umwandlung” von php in JavaScript auf diese art eher unueblich –> <script> var person_list = <?php echo json_encode($person_list); ?>; $(document).ready(function() { $.each( person_list, function( key, person ) { $('#liclass').append(“<li>”+ person['fullname'] +“</li” ); }); } ); </script> */ direkte Formatierung der Daten mit php in html <div id=“person_list”> <?php foreach ($person_list as $person) {
printf ("<li> %s, %s, %s </li>\n", $person['fullname'], $person['birthdate'], $person['country_code'] );
}
?> </div> <html>