Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem mit Koordinatenverlauf

Empfohlene Antworten

Veröffentlicht

Hallo,

ich bastel gerade an einem kleinen Tool, dass mir nach der Eingabe einer Start- und Zielkoordinate, eben diese beiden und alle anderen Koordinaten, die dazwischen liegen, anzeigt.

Also zum Beispiel:

Eingabe Start: 6 6 6

Eingabe Ziel: 10 10 10

6 6 6

6 8 9

6 10 20

9 10 30

.

.

.

10 10 10

Es sollen selbstverständlich nicht alle Werte zwischen Start und Ziel ausgegeben werden sondern nur die, die auch in der Datenbank (MySQL) stehen.

Bis jetzt sieht das so aus:


function Berechne_Weg($intStartGalaxy, $intStartSystem, $intStartPlanet, $intZielGalaxy, $intZielSystem, $intZielPlanet)
{
include ("mysql.inc.php");

if ($intZielGalaxy > $intStartGalaxy)
{
$strWhereclausel = "tbl_standorte.intGalaxy <= '".$intZielGalaxy."' AND tbl_standorte.intGalaxy >= '".$intStartGalaxy."'";
}
else
{
$strWhereclausel = "tbl_standorte.intGalaxy >= '".$intZielGalaxy."' AND tbl_standorte.intGalaxy <= '".$intStartGalaxy."'";
}

if ($intZielSystem > $intStartSystem)
{
$strWhereclausel .= " AND tbl_standorte.intSystem <= '".$intZielSystem."' AND tbl_standorte.intSystem >= '".$intStartSystem."'";
}
else
{
$strWhereclausel .= " AND tbl_standorte.intSystem >= '".$intZielSystem."' AND tbl_standorte.intSystem <= '".$intStartSystem."'";
}

if ($intZielPlanet > $intStartPlanet)
{
$strWhereclausel .= " AND tbl_standorte.intPlanet <= '".$intZielPlanet."' AND tbl_standorte.intPlanet >= '".$intStartPlanet."'";
}
else
{
$strWhereclausel .= " AND tbl_standorte.intPlanet >= '".$intZielPlanet."' AND tbl_standorte.intPlanet <= '".$intStartPlanet."'";
}


$strSQLString = "SELECT tbl_standorte.intGalaxy,
tbl_standorte.intSystem,
tbl_standorte.intPlanet,
tbl_user.varUser,
tbl_typ.varTyp
FROM tbl_standorte
INNER JOIN tbl_typ
INNER JOIN tbl_user
ON tbl_standorte.intTypID_FK = tbl_typ.intTypID_PK
ON tbl_standorte.intUserID_FK = tbl_user.intUserID_PK
WHERE ".$strWhereclausel."
ORDER BY tbl_standorte.intGalaxy, tbl_standorte.intSystem, tbl_standorte.intPlanet;";
$intErgebnis = mysql_db_query($strDBName, $strSQLString, $strServer) or die ($strSQLString ."<br />". mysql_error());

return $intErgebnis;

mysql_close();
}

[/PHP]

Nur funktioniert das nicht wirklich. Also Probleme tauchen auf, wenn der Start- größer ist als der Zielwert und es wird zwar ein Verlauf dargestellt, nur leider nicht der zwischen dem Gesamtwert der Koordinaten sondern nur der Einzelergebnisse

Zu der DB- Struktur wäre noch zu sagen, dass die tbl_standorte die Koordinaten in 3 Spalten enthält. Die Tabellen tbl_user und tbl_typ sind nur Resourcentabellen.

Die Lösung wird wahrscheinlich wieder ganz einfach sein und ich steh nur wieder auf dem Schlauch.

PS: Am liebsten wäre mir eine Lösung die nur über das SQL- Statement funktioniert. Also keine nach bzw. vorbereitung im php.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.