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-Daten in Tabelle ausgeben

Empfohlene Antworten

Veröffentlicht

Wie kriege ich MySQL-Daten in einer (HTML-)Tabelle ausgegeben?

Abfrage schaut zur Zeit so aus:

<?php
require("../../admin/config/global.inc.php");


$result = mysql_query("SELECT id,vorname,nachname,kunstname,geburtstag,position,verletzt,gesperrt,w_staerke,w_technik,w_kondition,w_frische,w_zufriedenheit,note_last,note_schnitt,sa_tore,sa_spiele FROM ".$conf['db_prefix']."_spieler WHERE verein_id='".$vereinid."' AND verein_id > '0' AND status='1' ORDER BY position ASC, nachname ASC, kunstname ASC");
echo ($vereinid);

if (mysql_num_rows($result)) {

$i = 1;

while ($row = mysql_fetch_array($result)) {

$name = ($row['kunstname']) ? $row['kunstname'] : substr($row['vorname'],0,1).". ". $row['nachname'];

$alter = getAge($row['geburtstag']);

if (in_array($row['id'],$aufgestellt)) $farbe_content = $conf['d_markierung_aufstellung'];
else $farbe_content = $conf['d_table_1'];

$gesperrt = $row['gesperrt'] + $row['verletzt'];
$gesperrt = ($gesperrt) ? $gesperrt : "";

$row_spieler = $block->getblock("row_spieler");

if ($conf['staerken_sichtbar']) {
$row_spieler -> assign_block("bl_staerken_row");
$row_spieler -> assign(array(
"w_staerke"=>$row['w_staerke'],
"w_technik"=>$row['w_technik'],
"w_kondition"=>$row['w_kondition'],
"w_frische"=>$row['w_frische'],
"w_zufriedenheit"=>$row['w_zufriedenheit'],
));
}

$row_spieler->assign(array(
"spieler_id"=>$row['id'],
"name"=>stripslashes($name),
"alter"=>$alter,
"position"=>$row['position'],
"gesperrt"=>$gesperrt,
"sa_tore"=>$row['sa_tore'],
"sa_spiele"=>$row['sa_spiele'],
"note_last"=>$row['note_last'],
"note_schnitt"=>$row['note_schnitt'],
"farbe_content"=>$farbe_content
));

$block->assign("row_spieler",$row_spieler);
$row_spieler->clear();

$i++;

}

$tpl_inhalt -> assign("bl_kader",$block);

}

mysql_free_result($result);
?>[/PHP]

Also im Original findet die Ausgabe in ein Template statt (z.B. [i]"$block->assign("row_spieler",$row_spieler);"[/i] oder [i]"$row_spieler = $block->getblock("row_spieler");"[/i]).

Wie kriege ich das jetzt aber ohne Template-System hin?

Kann mir da bitte jemand helfen?

Wie kriege ich MySQL-Daten in einer (HTML-)Tabelle ausgegeben?

...

Kann mir da bitte jemand helfen?

Moin,

schematisch etwa so (stark verkürzt und ungetestet):


    $result = mysql_query("SELECT nummer, bezeichnung 

                               FROM tabelle");

    echo "<TABLE>

            <THEAD>

                <TH>Nummer</TH>

                <TH>Bezeichnung</TH>

            </THEAD>

            <TBODY>";

    while ($row = mysql_fetch_array($result)) 

    {

        echo "<TR>";

        echo "<TD>", $row["nummer"],"</TD>";

        echo "<TD>", $row["bezeichnung"],"</TD>";

        echo "</TR>";

    }

    echo "</TBODY></TABLE>";

hth

Reinhold

  • Autor

Danke für die Hilfe Reinhold.

Mein Ergebnis sieht zwar ziemlich übel aus, aber ist ja nur 'n Prototyp und ich hoffe ich finde jemanden, der das besser umsetzen kann.

Wo wir grad dabei sind, hast Zeit? :D

Danke für die Hilfe Reinhold.

Mein Ergebnis sieht zwar ziemlich übel aus, aber ist ja nur 'n Prototyp und ich hoffe ich finde jemanden, der das besser umsetzen kann.

Wo wir grad dabei sind, hast Zeit? :D

Dann musst du meinen Arbeitgeber um ein Angebot bitten, das macht er sicher gern. Aber das wird nicht billig. :mod::mod::mod:

Reinhold

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.