summaryrefslogtreecommitdiff
path: root/includes/funktion_db_list.php
blob: 3e2878da58dc41e674093f9193af85da580e92d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
  function funktion_db_list($Table_Name) {
    global $con;

    $SQL = "SELECT * FROM `".$Table_Name."`";
    $Erg = mysql_query($SQL, $con);

  // anzahl zeilen
  $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>";

  echo "<tr class=\"contenttopic\">";
  for ($m = 0 ; $m < $Anzahl_Felder ; $m++)
  {
    echo "<th>". mysql_field_name($Erg, $m). "</th>";
  }
  echo "</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>"; 
    }
    echo "</tr>";
  }
  echo "</table>";
}

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";

  $Erg = sql_query($SQL);
  
  $html .= "<tr class=\"contenttopic\">";
  for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++)
  {
    $html .= "<th>". mysql_field_name($Erg, $m). "</th>";
  }
  $html .= "</tr>";

  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>"; 
    }
    $html .= "</tr>";
  }
  $html .= "</table>\n";
  return $html;
}

?>