source: trunk/www/db_po/get_progs.php@ 13764

Last change on this file since 13764 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.2 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 $_GET["fProgram"]="";
8 if (empty($_GET["fMode"]))
9 $_GET["fMode"]="view";
10
11 include("db.php");
12 $db_id = mysql_pconnect($host, $user, $pw);
13 if ($db_id==FALSE)
14 {
15 printf("mysql_connect returned the following error: %s\n", mysql_error());
16 die("");
17 }
18 mysql_select_db($db);
19
20 $query1 = "SELECT Max(fCounter) FROM History";
21 $result1=mysql_query($query1, $db_id);
22 $row1 = mysql_fetch_row($result1);
23 $maxcounter=$row1[0];
24 mysql_free_result($result1);
25
26 $query0 ="SELECT fProgram FROM ProgramOption ";
27 $query0.="WHERE fCounter=".$maxcounter." ";
28 $query0.="GROUP BY fProgram";
29 $result0=mysql_query($query0, $db_id);
30
31 if (strcmp($_GET["fMode"], "edit")==0)
32 printf("select program: <br>\n");
33
34 if (strcmp($_GET["fMode"], "view")==0)
35 printf("<select style='width: 150px' id='prog' size='1' onchange='get_keys(this.value,\"\",\"%s\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' class='Width'>\n", $_GET["fMode"]);
36 else
37 printf("<select style='width: 150px' id='prog' size='10' onchange=\"get_keys(this.value,'','%s');get_values(1,this.value,'all');\" class='Width'>\n", $_GET["fMode"]);
38
39 if (!empty($_GET["fProgram"]) && strcmp("all", $_GET["fProgram"])==0)
40 printf("<option value='all' selected> --- all programs --- </option>\n");
41 else
42 printf("<option value='all'> --- all programs --- </option>\n");
43 while ($row0 = mysql_fetch_row($result0))
44 if (!empty($_GET["fProgram"]) && strcmp($row0[0],$_GET["fProgram"])==0)
45 printf("<option value='%s' selected>%s </option>\n", $row0[0], $row0[0]);
46 else
47 printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
48 printf("</select>\n");
49 if (strcmp($_GET["fMode"], "edit")==0)
50 printf("<br>\n<button onClick='addRow(1,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\");' id='addrowprog' style='display:inline'>Add Prg/Key</button>\n");
51 mysql_free_result($result0);
52
53 mysql_close($db_id);
54
55 ini_set("display_errors", "Off");
56 ini_set("mysql.trace_mode", "Off");
57}
58?>
Note: See TracBrowser for help on using the repository browser.