diff options
author | Philip Häusler <msquare@notrademark.de> | 2011-06-11 17:09:30 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2011-06-11 17:09:30 +0200 |
commit | 3a31cebd1d39a6bcec2c22cbced60ca9d6177a42 (patch) | |
tree | 3cce86da26c408841e69bdee4e2ba012e0c72e47 /includes/funktion_db_list.php | |
parent | ebecae2ccc37c8930245a562852c035d5ce8d5a1 (diff) | |
parent | 80a1a65aefcd2f33951dc60c72d29df1ad19b187 (diff) |
merge special_includes_camp
Diffstat (limited to 'includes/funktion_db_list.php')
-rw-r--r--[-rwxr-xr-x] | includes/funktion_db_list.php | 81 |
1 files changed, 38 insertions, 43 deletions
diff --git a/includes/funktion_db_list.php b/includes/funktion_db_list.php index 9393e97e..35bb7255 100755..100644 --- a/includes/funktion_db_list.php +++ b/includes/funktion_db_list.php @@ -1,67 +1,62 @@ -<?PHP +<?php -function funktion_db_list($Table_Name) -{ + +// Gibt eine Tabelle generisch als HTML aus +function funktion_db_list($Table_Name) { global $con; - $SQL = "SELECT * FROM `".$Table_Name."`"; + $html = ""; + + $SQL = "SELECT * FROM `" . $Table_Name . "`"; $Erg = mysql_query($SQL, $con); // anzahl zeilen - $Zeilen = mysql_num_rows($Erg); + $Zeilen = mysql_num_rows($Erg); $Anzahl_Felder = mysql_num_fields($Erg); - echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">"; - echo "<caption>DB: $Table_Name</caption>"; + $html .= "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">"; + $html .= "<caption>DB: $Table_Name</caption>"; - echo "<tr class=\"contenttopic\">"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - { - echo "<th>". mysql_field_name($Erg, $m). "</th>"; + $html .= "<tr class=\"contenttopic\">"; + for ($m = 0; $m < $Anzahl_Felder; $m++) { + $html .= "<th>" . mysql_field_name($Erg, $m) . "</th>"; } - echo "</tr>"; + $html .= "</tr>"; - 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>"; + for ($n = 0; $n < $Zeilen; $n++) { + $html .= "<tr class=\"content\">"; + for ($m = 0; $m < $Anzahl_Felder; $m++) { + $html .= "<td>" . mysql_result($Erg, $n, $m) . "</td>"; } - echo "</tr>"; + $html .= "</tr>"; } - echo "</table>"; + $html .= "</table>"; + return $html; } -function funktion_db_element_list_2row( $TopicName, $SQL) -{ - global $con; +function funktion_db_element_list_2row($TopicName, $SQL) { + $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"; - echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n"; - echo "<caption>$TopicName</caption>"; -# echo "\t<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n"; + $Erg = sql_query($SQL); - $Erg = mysql_query($SQL, $con); - echo mysql_error($con); - - echo "<tr class=\"contenttopic\">"; - for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) - { - echo "<th>". mysql_field_name($Erg, $m). "</th>"; + $html .= "<tr class=\"contenttopic\">"; + for ($m = 0; $m < mysql_num_fields($Erg); $m++) { + $html .= "<th>" . mysql_field_name($Erg, $m) . "</th>"; } - echo "</tr>"; + $html .= "</tr>"; - for ($n = 0 ; $n < mysql_num_rows($Erg) ; $n++) - { - echo "<tr class=\"content\">"; - for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) - { - echo "<td>".mysql_result($Erg, $n, $m). "</td>"; + for ($n = 0; $n < mysql_num_rows($Erg); $n++) { + $html .= "<tr class=\"content\">"; + for ($m = 0; $m < mysql_num_fields($Erg); $m++) { + $html .= "<td>" . mysql_result($Erg, $n, $m) . "</td>"; } - echo "</tr>"; + $html .= "</tr>"; } - echo "</table>\n"; + $html .= "</table>\n"; + return $html; } - ?> |