Bei meinen Code sieht die hole_daten.php so aus
Aber wie gesagt , besser wäre es mit JSON zu machen und die Tabelle dann mit Javascript zusammen bauen.
Werde mal morgen ein Beispiel fertig machen
PHP-Code:
<?php
$dbuser="";
$dbpass="";
$dbname="";
$dbhost="localhost";
$neue_daten=1;
$link=mysqli_connect($dbhost,$dbuser,$dbpass, $dbname);
if(isset($_POST['check']) and $_POST['check']==1){
if($neue_daten==1){
echo 1;// die 1 simuliert keine neue Dateien. Hier müsstest du eine Abfrage machen ob es neue einträge gibt.Wenn ja muss das exit umgangen werden , wenn nein wird echo 1 ausgegeben
exit;
}else{
}
}
$mysqlineu=$link;
if(mysqli_connect_errno()){
die ("Connect failed: " . mysqli_connect_error());
}
if(isset($_POST['check']) and $_POST['check']==3){
$que1="SELECT * FROM TelegramStorage";
$result1 = mysqli_query($mysqlineu, $que1);
if($result1){
echo mysqli_num_rows($result1);
}else{
}
exit;
}
if(isset($_POST['limit'])){
$limit =$_POST['limit'];
}else{
$limit = 15;
}
if(isset($_POST['page'])){
$page =$_POST['page'];
}else{
$page = 1;
}
$start = ($page - 1) * $limit;
$query1="SELECT TelegramStorage.id,
TelegramStorage.Address,
TelegramStorage.Flags,
TelegramStorage.Message,
TelegramStorage.datum,
TelegramStorage.unerledigt,
TelegramDescription.address,
TelegramDescription.bezeichnung,
TelegramDescription.wache,
TelegramDescription.color_n,
TelegramDescription.hinweis,
TelegramDescription.background_n,
TelegramDescription.gruppe,
TelegramDescription.kommune,
TelegramDescription.kreis,
TelegramDescription.bosmon
FROM TelegramStorage
JOIN TelegramDescription
WHERE LEFT (TelegramStorage.Address, 7) = LEFT(TelegramDescription.address, 7)
AND (TelegramDescription.bosmon = 1)
AND (TelegramStorage.Flags = 1048576
OR TelegramStorage.Flags = 0
OR TelegramStorage.Flags = 537919488
OR TelegramStorage.Flags = 536870912)
ORDER BY ID asc LIMIT $start, $limit";
$sammeln="";
if($result = mysqli_query($mysqlineu, $query1)){
while ($ausgabe = mysqli_fetch_assoc($result)){
$sammeln.="<tr>";
$sammeln.="<td>".$ausgabe['id']."</td>";
$sammeln.="<td>";
if ($ausgabe['Flags'] == "1048576") {
$sammeln.="<img src='../web_images/Alarm_9.png'>" ;
}
if ($ausgabe['Flags'] == "537919488") {
$sammeln.="<img src='../web_images/Alarm_9.png'>" ;
}
if ($ausgabe['Flags'] == "0") {
$sammeln.="<img src='../web_images/server_5.png'>" ;
}
if ($ausgabe['Flags'] == "536870912") {
$sammeln.="<img src='../web_images/server_5.png' 'alt='Test'>" ;
}
$sammeln.="</td>";
$sammeln.="<td>".$ausgabe['datum']."</td>";
$sammeln.="<td>".$ausgabe['Address']."</td>";
$sammeln.="<td>";
if (substr($ausgabe['Address'],7) == "a") {
$sammeln.="<img src='../web_images/Alarm_14.png'>" ;
}
if (substr($ausgabe['Address'],7) == "b") {
$sammeln.="<img src='../web_images/limit.png'>" ;
}
if (substr($ausgabe['Address'],7) == "c") {
$sammeln.="<img src='../web_images/Alarm_12.png'>" ;
}
if (substr($ausgabe['Address'],7) == "d") {
$sammeln.="<img src='../web_images/Alarm_7.png'>" ;
}
$sammeln.="</td>";
$sammeln.="<td>".$ausgabe['bezeichnung']."</td>";
$sammeln.="<td>";
if ($ausgabe['gruppe'] == "FEUERWEHR") {
$sammeln.="<img src='../web_images/feuerloescher.png'>" ;
}
if ($ausgabe['gruppe'] == "RETTUNG") {
$sammeln.="<img src='../web_images/rettung_3.png'>" ;
}
if ($ausgabe['gruppe'] == "NAVI") {
$sammeln.="<img src='../web_images/Alarm_16.png'>" ;
}
if ($ausgabe['gruppe'] == "DEBUG") {
$sammeln.="<img src='../web_images/debug.png'>" ;
}
if ($ausgabe['gruppe'] == "SERVICE") {
$sammeln.="<img src='../web_images/Alarm_6.png'>" ;
}
if($ausgabe['gruppe']=='SIRENE') {
$sammeln.='<img src="../web_images/Alarm_11.png">';
}
if($ausgabe['gruppe']=='EINZELRUF') {
$sammeln.='<img src="../web_images/Alarm_8.png">';
}
if($ausgabe['gruppe']=='FAHRZEUG') {
$sammeln.='<img src="../web_images/feuerwehr_1.png">';
}
if($ausgabe['gruppe']=='TORSTEUERUNG') {
$sammeln.='<img src="../web_images/einstellungen.png">';
}
if($ausgabe['gruppe']=='DATAFILE') {
$sammeln.='<img src="../web_images/file.png">';
}
if($ausgabe['gruppe']=='WETTER') {
$sammeln.='<img src="../web_images/regen.png">';
}
if($ausgabe['gruppe']=='SWISSPHONE') {
$sammeln.='<img src="../web_images/herunterladen.png">';
}
if($ausgabe['gruppe']=='MESSAGE') {
$sammeln.='<img src="../web_images/email.png">';
}
if($ausgabe['gruppe']=='SYSTEM') {
$sammeln.='<img src="../web_images/settings.png">';
}
if($ausgabe['gruppe']=='KRANKENTRANSPORT') {
$sammeln.='<img src="../web_images/krankentransport_1.png">';
}
if($ausgabe['gruppe']=='PROBE') {
$sammeln.='<img src="../web_images/Alarm_12.png">';
}
if($ausgabe['gruppe']=='MULTIMASTER') {
$sammeln.='<img src="../web_images/warnen.png">';
}
if($ausgabe['gruppe']=='HVO') {
$sammeln.='<img src="../web_images/weste.png">';
}
if($ausgabe['gruppe']=='ARZT') {
$sammeln.='<img src="../web_images/arzt.png">';
}
$sammeln.="</td>";
$sammeln.="<td>".$ausgabe['kommune']."</td>";
$sammeln.="<td>".$ausgabe['hinweis']."</td>";
$sammeln.="<td>".$ausgabe['wache']."</td>";
$sammeln.='<td><button onclick="telegram()" >Telegram</button></td>';
$sammeln.='<td><button onclick="loeschen()" >Löschen</button></td>';
$sammeln.="</tr>";
}
}
echo $sammeln;
?>
Aber wie gesagt , besser wäre es mit JSON zu machen und die Tabelle dann mit Javascript zusammen bauen.
Werde mal morgen ein Beispiel fertig machen
Hier sind alle meine Lösungen aus allen Foren. Ich helfe auch in Facebook-chat