29 lines
627 B
PHP
29 lines
627 B
PHP
<?php
|
|
require 'db_config.php';
|
|
|
|
if(isset($_GET["id"]))
|
|
{
|
|
$id = $_GET["id"];
|
|
$sql = "SELECT professionid, professionname, description, apprenticeship from profession WHERE professionid = " . $id . ";";
|
|
}
|
|
else
|
|
{
|
|
$sql = "SELECT professionid, professionname, description, apprenticeship from profession;";
|
|
}
|
|
|
|
$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!']);
|
|
?>
|
|
|