2024-10-22 12:00:05 +00:00
|
|
|
<?php
|
|
|
|
$dbhost = "localhost";
|
|
|
|
$dbuser = "root";
|
|
|
|
$dbpass = "";
|
|
|
|
$dbname = "ocena_zachowania";
|
|
|
|
|
|
|
|
$con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
|
|
|
|
2024-10-22 12:19:26 +00:00
|
|
|
if (!$con) {
|
|
|
|
die("Błąd połączenia z bazą danych: " . mysqli_connect_error());
|
|
|
|
}
|
|
|
|
|
|
|
|
$ans = mysqli_query($con, "SELECT * FROM klasy;");
|
2024-10-22 12:00:05 +00:00
|
|
|
$json = array();
|
|
|
|
|
|
|
|
while($row = mysqli_fetch_assoc($ans)) {
|
|
|
|
$json[] = $row;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($json);
|
|
|
|
?>
|