a1/get.php

21 lines
359 B
PHP

<?php
<<<<<<< HEAD
$dbhost = "qstack.pl";
=======
$dbhost = "localhost";
>>>>>>> PiotrB
$dbuser = "root";
$dbpass = "";
$dbname = "db";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$ans = mysqli_query($conn, "SELECT * FROM osoby");
$json = array();
while ($row = mysqli_fetch_assoc($ans)) {
$json[] = $row;
}
echo json_encode($json);
?>