third commit

This commit is contained in:
james 2024-05-20 10:25:16 +02:00
parent e36e092d1d
commit 3594287422
3 changed files with 5 additions and 26 deletions

View File

@ -1,4 +1,4 @@
const url = "http://localhost/P20.05/get.php"
const url = "http://localhost/p20/get.php"
fetch(url)
.then(response => response.json())

View File

@ -1,8 +1,8 @@
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "osdb";
$dbhost = "qstack.pl";
$dbuser = "boost";
$dbpass = "pass";
$dbname = "osoby";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$ans = mysqli_query($conn, "SELECT * FROM osoby");

21
js.js
View File

@ -1,21 +0,0 @@
const url = "http://localhost/P20.05"
fetch('get.php')
.then(response => response.json())
.then( data => {
console.log(data)
})
function sortujSufiksy() {
const slowo = document.getElementById('slowo').value;
const sufiksy = [];
for (let i = 0; i < slowo.length; i++) {
sufiksy.push(slowo.slice(i));
}
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
sufiksy.sort();
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
}
function formatSufiksy(sufiksy) {
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
}