mastermind455
ISP
Hi all
i use the script below to query a mysql db and write the result in table on a webpage
-----------------------------------------------------------
<html>
<head>
<title>Query Test</title>
</head>
<body bgcolor=#BEE7AD>
<link href=" rel="stylesheet" type="text/css"/>
<?php
$benutzer= "ea";
$passwort= "*****";
$db = "protection";
$link = mysql_connect ( "localhost", $benutzer, $passwort ) ;
if ( ! $link )
die ( " Keine Verbindung zum MY SQL Server!" );
mysql_select_db ( $db, $link )
or die ( " Konnte Datenbank \"$db\" nicht öffnen !:
".mysql_error() );
$ergebnis = mysql_query ( "SELECT * FROM mos_mosform_formdata_1 ORDER BY Datum ASC ");
$anzahl_reihen = mysql_num_rows ( $ergebnis );
print "<font color =#0000000><center><strong>Einsaetze der Swiss Protection Guard GmbH! </font></center></strong>";
print "<table border=1>\n";
while ( $datensatz=mysql_fetch_row( $ergebnis ) )
{
print "<tr>\n";
foreach ($datensatz as $feld )
print "\t<td><font color=#000000>$feld</td></font>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close ( $link);
print "<strong><center><font color=#EE82EE><a href=javascript:top.close()>Fenster schliessen</font></strong></center>";
?>
</body>
</html>
------------------------------------------------------------
now everything works fine, but how can i write out also the names of the fields, p.a. there is a field named "Einsatzort" and this shoud be shown as a header over the table?
many thanks for your help
and happy new year
i use the script below to query a mysql db and write the result in table on a webpage
-----------------------------------------------------------
<html>
<head>
<title>Query Test</title>
</head>
<body bgcolor=#BEE7AD>
<link href=" rel="stylesheet" type="text/css"/>
<?php
$benutzer= "ea";
$passwort= "*****";
$db = "protection";
$link = mysql_connect ( "localhost", $benutzer, $passwort ) ;
if ( ! $link )
die ( " Keine Verbindung zum MY SQL Server!" );
mysql_select_db ( $db, $link )
or die ( " Konnte Datenbank \"$db\" nicht öffnen !:
".mysql_error() );
$ergebnis = mysql_query ( "SELECT * FROM mos_mosform_formdata_1 ORDER BY Datum ASC ");
$anzahl_reihen = mysql_num_rows ( $ergebnis );
print "<font color =#0000000><center><strong>Einsaetze der Swiss Protection Guard GmbH! </font></center></strong>";
print "<table border=1>\n";
while ( $datensatz=mysql_fetch_row( $ergebnis ) )
{
print "<tr>\n";
foreach ($datensatz as $feld )
print "\t<td><font color=#000000>$feld</td></font>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close ( $link);
print "<strong><center><font color=#EE82EE><a href=javascript:top.close()>Fenster schliessen</font></strong></center>";
?>
</body>
</html>
------------------------------------------------------------
now everything works fine, but how can i write out also the names of the fields, p.a. there is a field named "Einsatzort" and this shoud be shown as a header over the table?
many thanks for your help
and happy new year