|
1 <?php |
|
2 //header('content-type: text/html; charset=iso-8859-1'); // Standard, nicht notwendig |
|
3 //header('content-type: text/html; charset=utf-8'); |
|
4 |
|
5 // Beispiel mysqli-Klasse 'dbconnection' verwenden |
|
6 //include_once($_SERVER['DOCUMENT_ROOT']."/fhiiqm/inc/dbconnect.inc.php"); |
|
7 //echo $_SERVER['DOCUMENT_ROOT'] ."<br><br>\n"; |
|
8 include_once("inc/dbconnect.inc.php"); |
|
9 |
|
10 //setlocale (LC_ALL, 'de_DE'); |
|
11 // nur erfolgreich, wenn Sortierung der Spalte = latin1_general_ci by "LIKE 'y%'"! |
|
12 echo "before connection DB: ". Date("d.m.Y H:i:s")."<br><br>\n"; |
|
13 |
|
14 $dbc = new dbconnection(); |
|
15 // print "Error = <". $dbc->error ."><br>\n"; |
|
16 |
|
17 // printf ("Server = %s, DB = %s, User = %s<br><br>\n", $config["server"], $config["dbname"],$config["user"]); |
|
18 // echo $dbc->getclient_info()."<br>\n"; |
|
19 // echo $dbc->gethost_info()."<br>\n"; |
|
20 |
|
21 if (!$dbc->error) |
|
22 { |
|
23 // $dbc -> setcharset("iso-8859-1"); //latin1_general_ci |
|
24 // printf("<br>Current character set: %s<br>\n",$dbc -> _connectionid ->character_set_name()); //Standard: latin1 |
|
25 // $like = $dbc->escapestring('y'); |
|
26 // echo system("locale"). "<br><br>\n"; |
|
27 |
|
28 // COLLATE muss unbedingt fuer die Sortierreihenfolge angegeben werden! (19.05.2011) |
|
29 $sql = "SELECT p.`produkt_ID` , p.`prod_name` , g.prod_group_name, p.`ag_ID` , p.`imp_ID` , p.`conn_ID` , p.`Bemerkung` |
|
30 FROM Produkt p |
|
31 INNER JOIN Produkt_Gruppe g ON p.`prod_group_ID` = g.`prod_group_ID` |
|
32 WHERE prod_name LIKE '%' COLLATE latin1_general_ci |
|
33 ORDER BY prod_name "; ; |
|
34 echo "sql = $sql<br><br>\n"; |
|
35 if ($result = $dbc->queryObjectArray($sql)) |
|
36 { |
|
37 printf ("<p>Es wurden %s Saetze gefunden.</p>", $dbc->numrows($sql)); |
|
38 $bg1 = "#F8F8F8"; |
|
39 $bg2 = "#DEDFE1"; |
|
40 $bg = "#FFFFFF"; |
|
41 echo "<p><b>Tabelle Produkt</b></p>\n"; |
|
42 echo "<table cellpadding='2'>"; |
|
43 echo "<tr bgcolor='#B7CBFA'><th align='left'>ID</th><th align='left'>Produkt</th> |
|
44 <th align='left'>Prod-Gruppe</th><th align='left'>ag-ID</th><th align='left'>imp-ID</th><th align='left'>conn-ID</th><th align='left'>Bemerkung</th></tr>\n"; |
|
45 foreach($result as $row) |
|
46 { |
|
47 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
48 print "<tr bgcolor='" . $bg . "'><td>$row->produkt_ID</td><td>$row->prod_name</td><td>$row->prod_group_name</td><td>$row->ag_ID</td><td>$row->imp_ID</td><td>$row->conn_ID</td><td>$row->Bemerkung</td></tr>"; |
|
49 } |
|
50 echo "</table>\n"; |
|
51 // $dbc->close(); |
|
52 } |
|
53 else |
|
54 echo "leider kein Ergebnis!<br>\n"; |
|
55 if ($result = $dbc -> querySingleItem("SELECT COUNT(*) FROM produkt")) |
|
56 { |
|
57 echo "<p>Tabelle 'produkt' enthaelt $result Eintraege</p>\n"; |
|
58 } |
|
59 $dbc->close(); |
|
60 } |
|
61 ?> |