source: trunk/MagicSoft/Mars/datacenter/db/printtable.php@ 7873

Last change on this file since 7873 was 7873, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.0 KB
Line 
1<?php
2{
3 function PrintForm($_GET)
4 {
5 if (empty($_GET["fTable"]))
6 {
7 printf("ERROR - No table selected.\n");
8 return;
9 }
10 }
11
12 function PrintPage($html, $host, $user, $pw, $db, $limits, $rms)
13 {
14 if (empty($_GET["fTable"]))
15 {
16 printf("ERROR - No table selected.\n");
17 return;
18
19 }
20
21 $db_id = mysql_connect($host, $user, $pw);
22 if ($db_id==FALSE)
23 {
24 printf("mysql_connect returned the following error: %s\n", mysql_error());
25 die("");
26 }
27 mysql_select_db($db);
28
29 $query0 = "SELECT * FROM ";
30 $query0 .= $_GET["fTable"];
31
32 $result0 = mysql_query($query0, $db_id);
33
34 if ($result0)
35 {
36 if ($html=="1")
37 {
38 $alias = array
39 (
40 );
41 $rightalign = array
42 (
43 );
44 PrintMagicTable($result0, $alias, $rightalign, "", "", $_GET);
45 }
46 else
47 PrintText($result0);
48
49 mysql_free_result($result0);
50 }
51 mysql_close($db_id);
52
53 PrintSubmittedQuery($query0, $html, $db, "old");
54 }
55
56 include ("include.php");
57 include ("db.php");
58 include ("magicdefs.php");
59
60 ini_set("display_errors", "On");
61 ini_set("mysql.trace_mode", "On");
62
63 if (!empty($_GET["fSendTxt"]))
64 {
65 header("Content-type: application/octet");
66 header("Content-Disposition: attachment; filename=query-result.txt");
67
68 PrintPage("0", $host, $user, $pw, $db, $limits, $rms);
69 }
70 else
71 {
72 echo (file_get_contents("index-header.html"));
73
74 $environment = sizeof($_GET);
75
76 PrintForm($_GET);
77
78 if ($environment==0)
79 printf("No query submitted yet.<BR>");
80 else
81 PrintPage("1", $host, $user, $pw, $db, $limits, $rms);
82
83 echo (file_get_contents("index-footer.html"));
84 }
85
86 ini_set("display_errors", "Off");
87 ini_set("mysql.trace_mode", "Off");
88}
89?>
Note: See TracBrowser for help on using the repository browser.