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.

MySQL - Zeitabfrageproblem

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe ein kleines Problem mit der Abfrage einer Uhrzeit aus einer MySQL-DB.

In der DB sind Termine eingetragen, nach dem System: Datum (Format date), Uhrzeit (Format time), und Anlass (Format varchar).

Jetzt sollen auf einer Internetseite die jeweils aktuellsten Termine eingblendet werden, das klappt auch weitestgehend, nur wenn die Uhrzeit vor 12:00 Uhr liegt, gibt er den Termin nicht aus, sondern nimmt den nächsten.

Ich hole die Termine folgendermaßen aus der DB:

$query = "SELECT date_format(datum,'%d.%m.%Y'), time_format(uhrzeit, '%H:%i Uhr'), grund FROM termine where datum>='$aktdat' and uhrzeit>='$aktuhr' order by datum,uhrzeit LIMIT 0,1";

$result = mysql_query($query)

or die("Anfrage fehlgeschlagen");

// Ausgabe der Ergebnisse in HTML

echo "<h1>Nächster Termin:</h1>";

print "<table border = 0 width=650 align='center'>\n";

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

print "\t<tr>\n";

foreach ($line as $col_value) {

if($col_value=="") {

print "\t\t<th align=center> </th>\n";

}

else {

print "\t\t<th align=center>$col_value</th>\n";

}

}

print "\t</tr>\n";

}

print "</table>\n";

Ich hoffe, ihr versteht, was ich meine.

Danke schon mal im vorraus

honkstar

$query = "SELECT datum,uhrzeit,grund FROM termine where datum>='$aktdat' and uhrzeit>='$aktuhr' order by datum,uhrzeit LIMIT 0,1";

Hast du es mal so probiert, um zu sehen ob es vielleicht am Format liegt oder ob er die entspr. Daten von vorneherein falsch liefert?

Vielen Dank,

aber nach nem kräftigen Mittagessen hab ich die Lösung gefunden. ich mache in dem Script ne Abfrage auf die aktuelle Uhrzeit, und lasse mir alle termine anzeigen, die dahinter liegen, dann kann er auch nicht die termine morgens um 8 uhr finden... ;-)

Mann mann soviel Dummheit gehört bestraft.

Gruß

honkstar

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.