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.

Ganz einfache Frage / Abfrage

Empfohlene Antworten

Hi,

ich habe eine ganz einfache Produkt-Datenbank mit Bildupload Funktion geschrieben. Ich möchte nun eine Spalte "Bild" hinzufügen, welche für jede Zeile prüft ob in /bilder/upload ein Bild mit der ID der jeweiligen Zeile drin ist ([id].jpg und wenn ja eine Grafik dafür anzeigt. Denn beim Editieren bekommt das hochgeladene Bild als Dateinamen die ID der Zeile. Alles klar? Wäre cool, wenn ihr mir da weiterhelfen könntet. Hier der Code ...

//Anzahl der Datensätze
$num_rows = mysql_num_rows($result);

//Tabelle öffnen und Überschriften anzeigen
echo "<table width=800 border=1 align=center >
<tr>
<th><a href=\"?action=sortprodukt\">Produkt</a></th>
<th><a href=\"?action=sortform\">Form</a></th>
<th><a href=\"?action=sorttyp\">Typ</a></th>
<th><a href=\"?action=sortds\">Druckstufe</a></th>
<th><a href=\"?action=sortda\">Druckausgleich</a></th>
<th><a href=\"?action=sortsa\">Spindelabdichtung</a></th>
<th><a href=\"?action=sortsm\">Sondermerkmal</a></th>
<th><a href=\"?action=sorttext\">Beschreibung</a></th>
<th> </th>
<th> </th>
</tr>";

//Schleife zum Auslesen der Daten, bis der Wert num_rows erreicht ist
For ($i = 1; $i <= $num_rows; $i++)

//Beginnen der Aktionen der For-Schleife
{
$row=mysql_fetch_array($result);

//Ausgeben der Daten
echo "<tr><td>";
echo $row["produkt"];
echo "</td><td>";
echo $row["form"];
echo "</td><td>";
echo $row["typ"];
echo "</td><td>";
echo $row["ds"];
echo "</td><td>";
echo $row["da"];
echo "</td><td>";
echo $row["sa"];
echo "</td><td>";
echo $row["sm"];
echo "</td><td>";
echo $row["text"];
echo "</td>";

//Link für Editieren (edit)
echo "<td><a href=\"?id=";
echo $row["id"];
echo "&action=edit";
echo "\">Editieren</a>";
echo "</td>";

//Link für Löschen (clear)
echo "<td><a href=\"?id=";
echo $row["id"];
echo "&action=clear";
echo "\">Löschen</a>";
echo "</td></tr>";

//For-Schleife beenden
}

//Tabelle schließen
echo "</table>";[/PHP]

MfG

ALL:bimei


// Bild
$img = "/upload/bilder/". $row["id"] .".jpg";

echo "<td>";
if ( file_exists( $img)) {
echo "<img src=\"". $img ."\">";
}
echo "</td>";
[/PHP]

jeppa das wars vielen Dank :)

Grüße

ALL:bimei

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

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.