Compare commits
No commits in common. "piotrb" and "konradm" have entirely different histories.
7
fetch.js
7
fetch.js
|
@ -1,7 +0,0 @@
|
|||
const url = "http://localhost/15.05/get.php"
|
||||
|
||||
fetch( url + 'get.php')
|
||||
.then(response => response.json())
|
||||
.then( data => {
|
||||
console.log(data)
|
||||
})
|
16
get.php
16
get.php
|
@ -1,16 +0,0 @@
|
|||
<?
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "osoby";
|
||||
|
||||
$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);
|
||||
|
||||
?>
|
13
index.html
13
index.html
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<script src="fetch.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue