bildungdb/api/kompetenzen.php
2023-01-08 22:45:34 +01:00

30 lines
622 B
PHP

<?php
require 'db_config.php';
if(isset($_GET["id"]))
{
$id = $_GET["id"];
$sql = "SELECT competenceid, competence, competencedescription, dauer from competence WHERE competenceid = " . $id . ";";
}
else
{
$sql = "SELECT competenceid, competence, competencedescription, dauer FROM competence;";
}
$result = $mysqli->query($sql);
if ($result != null)
{
while($row = $result->fetch_assoc()){
$json[] = $row;
}
$data = $json;
$result = mysqli_query($mysqli,$sql);
echo json_encode($data);
}
else
echo json_encode(['success' => 0, 'message' => 'keine Daten empfangen!']);
?>