Compare commits

..

No commits in common. "b89ee1e8b56bde589ad98392600b0d726fabf637" and "5f5c9affe672ab28f8ed8ab06f89902ea6da2442" have entirely different histories.

4 changed files with 26 additions and 6 deletions

View File

@ -1,12 +1,14 @@
const url = "http://localhost/dev/get.php"
// const url = "http://qstack.pl:8080/z1/get.php"
//const url = "http://localhost/p20/get.php"
const url = "http://qstack.pl:8080/z1/get.php"
let lista
fetch(url)
.then(response => response.json())
.then(data => {
sortujSufiksy(data)
});
function wyswietlSufiksy(data) {
function sortujSufiksy(data) {
data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `<li> ${JSON.stringify(element.osoby)} </li>`);
}

View File

@ -11,6 +11,7 @@
<body>
<h1>Sortowanie Sufiksów</h1>
<input type="text" id="slowo" placeholder="Podaj słowo">
<button onclick="sortujSufiksy()">Sortuj Sufiksy</button>
<h2>Nieposortowane Sufiksy</h2>
<div class="pre" id="nieposortowane"></div>
@ -19,7 +20,7 @@
<script src="fetch.js"></script>
<li id="lista">
<ol></ol>
<ol></ol>
</li>
</body>

17
qstack.php Normal file
View File

@ -0,0 +1,17 @@
<?php
$dbhost = "qstack.pl";
$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);
?>

View File

@ -1,6 +1,6 @@
body {
font-family: Arial, sans-serif;
background-color: #f7f7f7f5;
background-color: #f5f5f5;
color: #333;
margin: 0;
padding: 20px;