inf03-06.2022-z2/php/get.php

16 lines
284 B
PHP
Raw Normal View History

2024-11-14 13:37:28 +00:00
<?php
$polaczenie = mysqli_connect("172.18.0.3", "root", "secret", "db");
$kwerenda = mysqli_query($polaczenie, "SELECT * FROM paliwa ORDER BY id DESC LIMIT 3;");
$json = array();
while($row = mysqli_fetch_assoc($kwerenda)) {
$json [] = $row;
};
echo json_encode($json);
?>