p4.10/gget.php

16 lines
284 B
PHP

<?php
$polaczenie = mysqli_connect("172.19.0.4", "root", "secret", "db");
$kwerenda = mysqli_query($polaczenie, "SELECT * FROM liczby ORDER BY id DESC LIMIT 3;");
$json = array();
while($row = mysqli_fetch_assoc($kwerenda)) {
$json [] = $row;
};
echo json_encode($json);
?>