query(" SELECT * FROM places WHERE name LIKE '%" . strtolower($meta) . "%' "); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { // Wenn die suche leer ist, sollen auch keine Ergebnisse kommen (siehe Vorschläge ignorieren) if($meta == "") { return; } ?>
'); search('results');">
Vorschläge ignorieren
query(" SELECT m.id AS measurement_id, m.comment AS comment, m.timestamp AS timestamp, m.place_name AS place_name, b.value AS bit_value, b.position AS bit_position FROM measurements m JOIN places p ON p.name = m.place_name JOIN measurement_program_id_bits b ON b.measurement_id = m.id ORDER BY m.id "); /* Ausgabe sieht z.B. so aus: | measurement_id | comment | timestamp | place_name | bit_value | bit_position | | -------------- | ------- | --------- | ------------ | --------- | ------------ | | 1 | xyz.. | 34535454 | Dudweiler Df | S | 0 | | 1 | xyz.. | 34535454 | Dudweiler Df | - | 1 | | 1 | xyz.. | 34535454 | Dudweiler Df | 4 | 2 | | 1 | xyz.. | 34535454 | Dudweiler Df | - | 3 | | 1 | xyz.. | 34535454 | Dudweiler Df | - | 4 | | 7 | abc.. | 48548574 | Mannheim Hbf | A | 0 | | 7 | abc.. | 48548574 | Mannheim Hbf | 6 | 1 | | 7 | abc.. | 48548574 | Mannheim Hbf | 4 | 2 | | 7 | abc.. | 48548574 | Mannheim Hbf | - | 3 | | 7 | abc.. | 48548574 | Mannheim Hbf | S | 4 | */ // Die Datenbank wird als dreifach indexiertes Array gespeichert $database_db = []; while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $database_db[$row["place_name"]][$row["measurement_id"]]["program_id_bits"][$row["bit_position"]] = $row["bit_value"]; $database_db[$row["place_name"]][$row["measurement_id"]]["comment"] = $row["comment"]; $database_db[$row["place_name"]][$row["measurement_id"]]["timestamp"] = $row["timestamp"]; } /* $database_db └── $row["place_name"] └── $row["measurement_id"] ├── "program_id_bits" │ └── $row["bit_position"] │ └── $row["bit_value"] ├── "program_id_string" │ └── implode('', $bits) ├── "comment" │ └── $row["comment"] └── "timestamp" └── $row["timestamp"] */ // speichere die Bits als String, damit diese einfacher durchsuchbar sind foreach ($database_db as $place => $entries) { foreach ($entries as $index => $info) { $bits = $info['program_id_bits']; $database_db[$place][$index]['program_id_string'] = implode('', $bits); } } // durchsuche nach der Query im Programm-ID-String foreach($database_db as $place_name => $measurements) { $found = false; foreach ($measurements as $measurement_id => $measurement) { if(str_contains(strtolower($measurement["program_id_string"]), strtolower($meta))) { $found = true; } } if($found != true) { continue; } ?>
      
$measurement) { if(!str_contains(strtolower($measurement["program_id_string"]), strtolower($meta))) { continue; } print('
'); $i = 0; foreach($measurement["program_id_bits"] as $programIDChar) { echo '' . $programIDChar . ''; $i++; } print('
' . date("d.m.Y H:i:s", $measurement["timestamp"]) . '
'); ?>
'); if(!empty($measurement["comment"])) { print('
'); echo $measurement["comment"]; print('
'); } } ?>
query(" SELECT m.id AS measurement_id, m.comment AS comment, m.timestamp AS timestamp, m.place_name AS place_name, b.value AS bit_value, b.position AS bit_position FROM measurements m JOIN places p ON p.name = m.place_name JOIN measurement_program_id_bits b ON b.measurement_id = m.id ORDER BY m.id "); // Die Datenbank wird als dreifach indexiertes Array gespeichert $database_db = []; while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $database_db[$row["place_name"]][$row["measurement_id"]]["program_id_bits"][$row["bit_position"]] = $row["bit_value"]; $database_db[$row["place_name"]][$row["measurement_id"]]["comment"] = $row["comment"]; $database_db[$row["place_name"]][$row["measurement_id"]]["timestamp"] = $row["timestamp"]; } /* $database_db └── $row["place_name"] └── $row["measurement_id"] ├── "program_id_bits" │ └── $row["bit_position"] │ └── $row["bit_value"] ├── "program_id_string" │ └── implode('', $bits) ├── "comment" │ └── $row["comment"] └── "timestamp" └── $row["timestamp"] */ foreach($database_db as $place_name => $measurements) { ?>
[]