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.

Empfohlene Antworten

Veröffentlicht

Hi,

ich mache in PHP eine Mysql-Abfrage.


}
$sql = "SELECT * FROM pp_products WHERE cat=6 OR cat=7 OR cat=8 ORDER BY date DESC LIMIT 8";
$result = mysql_query($sql, $conn);
if ($result)
{
[/PHP]

Das Ergebnis wird so dargestellt:

[PHP]{

echo('<table border="0" cellspacing="0" cellpadding="0">');
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

{
$datum = datum_richten($row['date']);
echo '<tr><td colspan=3 height=5></td></tr><tr><td valign=top><b>'.$datum.'</b></td><td width=10></td><td valign=top><a href=http://xxx/showproduct.php?product='.$row['id'].'&cat='.$row['cat'].'>'.$row['title'].'</a></td><td width=10></td><td valign=top>'.$row['extra2'].'</td></tr>';

}
echo ('</table><table><tr><td height=10></td></tr></table>');

}

Ich möchte nun die Darstellung der Ausgabe so erweitern, dass in der Zeile je Kategorie (Cat 5, 6 oder 7) noch eine zusätzliche Angabe (Cat 5 = A, Cat 6= VZ/TZ) aufgeführt wird.

Wie machen?

willst du jetzt in jeder zeile diese angabe mit ausgeben oder nur wenn sich die zeile im cat-typ (was immer das hier auch sen soll) ändert?

für ersteres dürfte es doch reichen in deiner ausgabe einfach noch ein

'<td>Cat ' . $row['cat'] . '=' . $row['zusaetzliche_angabe'] . '</td>'

einzufügen. für zweiteres musst du jedem schleifendurchlauf den aktuellen cat-wert speichern und ebenfalls in jeder runde überprüfen ob sich der aktuelle vom speicherwert dem des vorhergehenden schleifendurchlaufes unterscheidet. nur im falle einer unterscheidung die oben genante spalte ausgeben und ansonsten einfach ein

<td></td>

ausgeben.

oder hab ich da jetzt was falsch verstanden:confused:

lg

jasso

Ich möchte nun die Darstellung der Ausgabe so erweitern, dass in der Zeile je Kategorie (Cat 5, 6 oder 7) noch eine zusätzliche Angabe (Cat 5 = A, Cat = VZ/TZ) aufgeführt wird.

Wie machen?

hm...



$catArray = Array(5 => 'A', 6=> 'VZ/TZ', 7=> 'XX/XX');
...
echo '<td>[...]'.$catArray[$row['cat']].'</td>';
...

[/php]

Oder hab ich was übersehen?

  • Autor

Super - Danke erstmal für die Ansätze.

Hab oben nochmal einen Fehler korrigiert.

Es geht hier auf Fachinformatiker.de darum die neuen Stellenanzeigen aus dem Script Photopost auf der Hauptseite darzustellen. Es soll nun kenntlich gemacht werden, ob es bei der Anzeige um einen Ausbildungsplatz oder eine VZ/TZ-Stelle handelt.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.