PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $mysqli->query("create table User (id int, login varchar(255))"); $mysqli->query("insert User (id, login) VALUES (1, 'Vasya')"); $mysqli->query("insert User (id, login) VALUES (2, 'Petya')"); $result = $mysqli->query("SELECT id, login FROM User"); $data = $result->fetch_all(MYSQLI_ASSOC); ?> <?php foreach ($data as $row): ?> <tr> <td><?= htmlspecialchars($row['login']) ?></td> </tr> <?php endforeach ?>
Show:  
Copy Clear