source: trunk/www/db_po/get_keys.php@ 19598

Last change on this file since 19598 was 12449, checked in by Daniela Dorner, 13 years ago
removed variable selectsize from functions and set size of select box depending on fMode
  • Property svn:executable set to *
File size: 2.5 KB
Line 
1<?php
2{
3 ini_set("display_errors", "On");
4 ini_set("mysql.trace_mode", "On");
5
6 if (empty($_GET["fProgram"]))
7 {
8 echo "Please select a program.<br>";
9 return;
10 }
11 if (empty($_GET["fKey"]))
12 $_GET["fKey"]="";
13 if (empty($_GET["fMode"]))
14 $_GET["fMode"]="view";
15
16 include("db.php");
17 $db_id = mysql_pconnect($host, $user, $pw);
18 if ($db_id==FALSE)
19 {
20 printf("mysql_connect returned the following error: %s\n", mysql_error());
21 die("");
22 }
23 mysql_select_db($db);
24
25 $query1 = "SELECT Max(fCounter) FROM History";
26 $result1=mysql_query($query1, $db_id);
27 $row1 = mysql_fetch_row($result1);
28 $maxcounter=$row1[0];
29 mysql_free_result($result1);
30
31 $query0="SELECT Concat(fKey1, fKey2) as ourkeys from ProgramOption ";
32 $query0.="WHERE fCounter=".$maxcounter." ";
33 if ($_GET["fProgram"]!="all")
34 $query0.="AND fProgram='".$_GET["fProgram"]."' ";
35 $query0.="GROUP BY ourkeys";
36
37 $result0=mysql_query($query0, $db_id);
38
39 if (strcmp($_GET["fMode"], "edit")==0)
40 printf("select key: <br>\n");
41// else
42// printf("select key: \n");
43
44 if (strcmp($_GET["fMode"], "view")==0)//reload tables in case of mode 'view'
45 printf("<select style='width:300px' id='key' size='1' onchange='get_values(1,\"%s\",this.value,\"%s\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' class='Width'>\n",
46 $_GET["fProgram"], $_GET["fMode"]);
47 else
48 printf("<select style='width:300px' id='key' size='20' onchange=\"get_values(1,'%s',this.value,'%s')\" class='Width'>\n",
49 $_GET["fProgram"], $_GET["fMode"]);
50
51 if (!empty($_GET["fKey"]) && strcmp("all", $_GET["fKey"])==0)
52 printf("<option value='all' selected> --- all keys --- </option>\n");
53 else
54 printf("<option value='all'> --- all keys --- </option>\n");
55 while ($row0 = mysql_fetch_row($result0))
56 if (!empty($_GET["fKey"]) && strcmp($row0[0], $_GET["fKey"])==0)
57 printf("<option value='%s' selected>%s </option>\n", $row0[0], $row0[0]);
58 else
59 printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
60 printf("</select>\n");
61 if (strcmp($_GET["fMode"], "edit")==0)
62 printf("<br>\n<button onClick='addRow(2,\"%s\",\"\",\"\",\"\",\"\",\"\",\"\",\"\");' id='addrowkey' style='display:inline'>Add Key</button>\n", $_GET["fProgram"]);
63 mysql_free_result($result0);
64
65 mysql_close($db_id);
66
67 ini_set("display_errors", "Off");
68 ini_set("mysql.trace_mode", "Off");
69}
70?>
Note: See TracBrowser for help on using the repository browser.