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

25 lines
523 B
PHP

<?php
require './db_config.php';
$sql = "SELECT apprenticeid, firstname, lastname, a.groupid, groupname, sex, date_of_birth, date_joined, date_leave ";
$sql .= "FROM apprentice a left join gruppe g on a.groupid = g.groupid ";
$result = $mysqli->query($sql);
if ($result != null)
{
while($row = $result->fetch_assoc()){
$json[] = $row;
}
$data['apprentice'] = $json;
$result = mysqli_query($mysqli,$sql);
echo json_encode($data);
}
else
echo json_encode("keine Daten empfangen!");
?>