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.

JimTheLion

User
  • Registriert

  • Letzter Besuch

Lösungen

  1. JimTheLion's Beitrag in SQL, PHP wurde als Antwort markiert.   
    Moin,
    dein Code ist anfällig für SQL-Injections, ist aber schon nah an der sicheren Lösung dran.
    $sql = ".... WHERE thema.id = ? ...."; $res = $pdo->prepare($sql); $res->execute([$idthema]); https://de.wikipedia.org/wiki/Prepared_Statement
    Falls $idthema vom Integer-Datentyp ist, würde ein explizites Casten auch dafür sorgen, dass die Abfrage sicher ist.
    $sql = ".... WHERE thema.id = " . (int) $idthema . " ...";  
    Wenn du bei deinem aktuellen Ansatz, Beiträge und Kommentare innerhalb einer Abfrage zu holen, bleiben möchtest, kannst du einen Gruppenbruch verwenden: https://php-de.github.io/jumpto/gruppenbruch/
    Das würde dann dem Beispiel 1B entsprechen.
     
    Die Alternative ist, zuerst die Beiträge aus der Datenbank zu holen und anschließend die jeweiligen Kommentare über weitere Abfragen abzuholen.
    Ahand der Zeilenanzahl sieht es aus, als würdest du noch nicht nach EVA-Prinzip arbeiten und noch die Datenverarbeitung/Abholung und die Ausgabe vermischen. Dann ist der zweite Ansatz wahrscheinlich einfacher umzusetzen.
     
  2. JimTheLion's Beitrag in XSLT / XPath: Problem mit Darstellung von Wert in HTML Tabelle wurde als Antwort markiert.   
    Jop, hab auch ein bisschen ausprobiert und man braucht wohl leider eine Variable.
    <?xml version='1.0' encoding='UTF-8'?> <?xml-stylesheet type="text/xsl" href="xsltest.xsl"?> <root> <elemente> <element> <id>1</id> </element> <element> <id>2</id> </element> </elemente> <testfälle> <testfall> <tid>1</tid> <beschreibung>hshgoasn</beschreibung> </testfall> <testfall> <tid>2</tid> <beschreibung>dhfoashgfon</beschreibung> </testfall> </testfälle> </root> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:for-each select="./root/elemente/element"> <xsl:variable name="elemtId" select="./id" /> ID: <xsl:value-of select="./id"/> Beschreibung: <xsl:value-of select="//testfälle/testfall[./tid=$elemtId]/beschreibung"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
     

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.