1
Hallo,
ich brauche eine Abfrage die die Daten so darstellt:
ich brauche eine Abfrage die die Daten so darstellt:
$data = array(
array(
"date_from" => "2025-06-30",
"date_to" => "2025-07-03",
"class" => "bg-danger text-white",
"event_name" => "sick leave"
),
array(
"date_from" => "2025-07-25",
"date_to" => "2025-07-30",
"class" => "bg-success text-white",
"event_name" => "vacation"
)
);
Versucht habe ich es mit: $result = mysqli_query($con, "SELECT von, bis, bemerkung FROM preise where year(von)=year(NOW()) order by von") ;
$rowcount = mysqli_num_rows( $result );
$i = 0;
$data = array();
while($row = mysqli_fetch_array($result)) {
$data['date_from'] = $row[$i]['von'];
$data['date_to'] = $row[$i]['bis'];
//$data['class'] = $row[$i]['type'];
$data['class']= "bg-success text-white";
$data['event_name'] = $row[$i]['bemerkung'];
$i++;
}