engelsystem/includes/funktion_db_list.php

65 lines
1.5 KiB
PHP
Raw Normal View History

2011-06-01 12:13:39 +02:00
<?php
function funktion_db_list($Table_Name) {
global $con;
2011-06-01 12:13:39 +02:00
$SQL = "SELECT * FROM `".$Table_Name."`";
$Erg = mysql_query($SQL, $con);
2011-06-01 12:13:39 +02:00
// anzahl zeilen
$Zeilen = mysql_num_rows($Erg);
2011-06-01 12:13:39 +02:00
$Anzahl_Felder = mysql_num_fields($Erg);
2011-06-01 12:13:39 +02:00
echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">";
echo "<caption>DB: $Table_Name</caption>";
2011-06-01 12:13:39 +02:00
echo "<tr class=\"contenttopic\">";
for ($m = 0 ; $m < $Anzahl_Felder ; $m++)
{
echo "<th>". mysql_field_name($Erg, $m). "</th>";
}
echo "</tr>";
2011-06-01 12:13:39 +02:00
for ($n = 0 ; $n < $Zeilen ; $n++)
{
echo "<tr class=\"content\">";
for ($m = 0 ; $m < $Anzahl_Felder ; $m++)
{
echo "<td>".mysql_result($Erg, $n, $m). "</td>";
}
echo "</tr>";
}
echo "</table>";
}
2010-11-08 23:38:31 +01:00
function funktion_db_element_list_2row( $TopicName, $SQL)
{
2011-06-03 06:40:29 +02:00
$html = "";
$html .= "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n";
$html .= "<caption>$TopicName</caption>";
# $html .= "<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n";
2010-11-08 23:38:31 +01:00
2011-06-03 06:40:29 +02:00
$Erg = sql_query($SQL);
2011-06-01 12:13:39 +02:00
2011-06-03 06:40:29 +02:00
$html .= "<tr class=\"contenttopic\">";
2011-06-01 12:13:39 +02:00
for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++)
{
2011-06-03 06:40:29 +02:00
$html .= "<th>". mysql_field_name($Erg, $m). "</th>";
2011-06-01 12:13:39 +02:00
}
2011-06-03 06:40:29 +02:00
$html .= "</tr>";
2010-11-08 23:38:31 +01:00
2011-06-01 12:13:39 +02:00
for ($n = 0 ; $n < mysql_num_rows($Erg) ; $n++)
{
2011-06-03 06:40:29 +02:00
$html .= "<tr class=\"content\">";
2011-06-01 12:13:39 +02:00
for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++)
{
2011-06-03 06:40:29 +02:00
$html .= "<td>".mysql_result($Erg, $n, $m). "</td>";
2011-06-01 12:13:39 +02:00
}
2011-06-03 06:40:29 +02:00
$html .= "</tr>";
2011-06-01 12:13:39 +02:00
}
2011-06-03 06:40:29 +02:00
$html .= "</table>\n";
return $html;
}
?>