Compare commits

..

No commits in common. "d8a7ad538314d63a5e17e7d31dde586bf86fd83d" and "364c6f3ca9b4ba8788adc7021f3ea791646cfcf2" have entirely different histories.

3 changed files with 4 additions and 13 deletions

View File

@ -1,14 +1,13 @@
<?php
<?
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "osdb";
$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;
}

View File

@ -15,7 +15,7 @@
<pre id="nieposortowane"></pre>
<h2>Posortowane Sufiksy</h2>
<pre id="posortowane"></pre>
<script src="fetch.js"></script>
<script src="js.js"></script>
</body>

10
js.js
View File

@ -1,11 +1,3 @@
const url = "http://localhost/pk/"
fetch( url + 'get.php')
.then(response => response.json())
.then( data => {
console.log(data)
})
function sortujSufiksy() {
const slowo = document.getElementById('slowo').value;
const sufiksy = [];
@ -15,7 +7,7 @@ function sortujSufiksy() {
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
sufiksy.sort();
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
}git
}
function formatSufiksy(sufiksy) {
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
}