PCQRSCANER/index1.php
2019-12-22 21:51:47 +01:00

114 lines
2.3 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="Stylesheet" href="style/style.css">
</head>
<body>
<?php
$conn = new mysqli("localhost", "root", "", "komputery") or die("Błąd");
$wynik = $conn->query("SELECT * FROM parametry WHERE Id = 2 ");
echo "<h1>Dane twojego komputera: </h1>";
echo "<br>";
if($wynik->num_rows > 0){
echo "<table>";
echo "<tr>";
echo "<th>Id</th>";
echo "<th>Procesor</th>";
echo "<th>Plyta_Glowna</th>";
echo "<th>Pamiec_Ram</th>";
echo "<th>Dysk</th>";
echo "<th>Karta_Graficzna</th>";
echo "</tr>";
while( $wiersz = $wynik->fetch_assoc() ){
echo "<tr>";
echo "<td>" . $wiersz["Id"] . "</td>";
echo "<td>" . $wiersz["Procesor"] . "</td>";
echo "<td>" . $wiersz["Plyta_Glowna"] . "</td>";
echo "<td>" . $wiersz["Pamiec_Ram"] . "</td>";
echo "<td>" . $wiersz["Dysk"] . "</td>";
echo "<td>" . $wiersz["Karta_Graficzna"] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br>";
}
else {
echo "Nie ma nic w bazie danych";
}
$wynik = $conn->query("SELECT * FROM uzytkownicy WHERE Id = 2 ");
echo "<h1>Informacje o uzytkowniku: </h1>";
if($wynik->num_rows > 0){
echo "<table>";
echo "<tr>";
echo "<th>Id</th>";
echo "<th>Imie</th>";
echo "<th>Nazwisko</th>";
echo "<th>Data wydania</th>";
echo "<th>Data zakonczenia leasingu</th>";
echo "<th>Dzial</th>";
echo "</tr>";
while( $wiersz = $wynik->fetch_assoc() ){
echo "<tr>";
echo "<td>" . $wiersz["Id"] . "</td>";
echo "<td>" . $wiersz["Imie"] . "</td>";
echo "<td>" . $wiersz["Nazwisko"] . "</td>";
echo "<td>" . $wiersz["Data_wydania"] . "</td>";
echo "<td>" . $wiersz["Data_zak_lea"] . "</td>";
echo "<td>" . $wiersz["Dzial"] . "</td>";
echo "</tr>";
}
echo "</table>";
}
else {
echo "Nie ma nic w bazie danych";
}
$conn->close();
?>