Index: trunk/ippMonitor/def/autocode.php
===================================================================
--- trunk/ippMonitor/def/autocode.php	(revision 18138)
+++ trunk/ippMonitor/def/autocode.php	(revision 18143)
@@ -74,8 +74,8 @@
 
 // query restriction form
-echo "<tr>\n";
+// echo "<tr>\n";
 // echo "<td class=list> <input type=\"text\" name=\"expID\"></td>\n";
 // ** TABLE QUERY **
-echo "</tr>\n";
+// echo "</tr>\n";
 
 // list the results
Index: trunk/ippMonitor/def/detProcessedImfile.d
===================================================================
--- trunk/ippMonitor/def/detProcessedImfile.d	(revision 18138)
+++ trunk/ippMonitor/def/detProcessedImfile.d	(revision 18143)
@@ -12,8 +12,8 @@
 FIELD rawExp.exp_name,                  5, %s,     Exp Name
 FIELD detProcessedImfile.class_id,      8, %s,     Chip ID
-FIELD detProcessedImfile.bg, 	        8, %s,     backgnd
+FIELD detProcessedImfile.bg, 	        8, %f,     backgnd
 FIELD detProcessedImfile.bg_stdev,      8, %s,     stdev
 FIELD detProcessedImfile.bg_mean_stdev, 8, %s,     [stdev]
-FIELD detProcessedImfile.path_base,     5, %s,     path_base
+FIELD detProcessedImfile.path_base,     10, %s,     path_base
 
 TAIL PHP insert_image ('PPIMAGE.JPEG1');
Index: trunk/ippMonitor/raw/ipp.php
===================================================================
--- trunk/ippMonitor/raw/ipp.php	(revision 18138)
+++ trunk/ippMonitor/raw/ipp.php	(revision 18143)
@@ -364,6 +364,13 @@
 }
 
-function check_restrict ($key, $where) {
+function check_restrict ($key, $where, $mode) {
   $htmlkey = preg_replace ('|\.|', '_', $key);
+  if ($mode == 'min') {
+    $htmlkey = $htmlkey . "_min";
+  }
+  if ($mode == 'max') {
+    $htmlkey = $htmlkey . "_max";
+  }
+
   if ($_SERVER[REQUEST_METHOD] == 'GET') { 
     $value = $_GET[$htmlkey]; 
@@ -371,11 +378,24 @@
     $value = $_POST[$htmlkey];
   }
-  if ($value != "") {
-    if ($where) {
-      $where = $where . " AND $key = '$value'";
-    } else {
-      $where = "WHERE $key = '$value'";
-    }
-  }
+  if ($value == "") { return $where; }
+  if ($where) { 
+    $where = $where . " AND"; 
+  } else {
+    $where = "WHERE";
+  }
+
+  if ($mode == 'string') {
+    // can we pass the '%' through the html?
+    $where = $where . " $key like '$value'";
+  } 
+  if ($mode == 'min') {
+    // can we pass the '%' through the html?
+    $where = $where . " $key >= '$value'";
+  } 
+  if ($mode == 'max') {
+    // can we pass the '%' through the html?
+    $where = $where . " $key <= '$value'";
+  } 
+
   return $where;
 }
@@ -394,5 +414,6 @@
 }
 
-function button_restrict ($key, $line) {
+// if we have a restriction for a string-valued field, supply it to outgoing links
+function button_restrict_string ($key, $line) {
   $htmlkey = preg_replace ('|\.|', '_', $key);
   if ($_SERVER[REQUEST_METHOD] == 'GET') { 
@@ -411,4 +432,42 @@
 }
 
+// for numerical fields, test for both 'min' and 'max' values
+function button_restrict_min ($key, $line) {
+  $htmlkey = preg_replace ('|\.|', '_', $key);
+  $htmlkey = $htmlkey . '_min';
+  if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+    $value = $_GET[$htmlkey]; 
+  } else {
+    $value = $_POST[$htmlkey];
+  }
+  if ($value != "") {
+    if ($line) {
+      $line = $line . "&$htmlkey=$value";
+    } else {
+      $line = "$htmlkey=$value";
+    }
+  }
+  return $line;
+}
+
+// for numerical fields, test for both 'min' and 'max' values
+function button_restrict_max ($key, $line) {
+  $htmlkey = preg_replace ('|\.|', '_', $key);
+  $htmlkey = $htmlkey . '_max';
+  if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+    $value = $_GET[$htmlkey]; 
+  } else {
+    $value = $_POST[$htmlkey];
+  }
+  if ($value != "") {
+    if ($line) {
+      $line = $line . "&$htmlkey=$value";
+    } else {
+      $line = "$htmlkey=$value";
+    }
+  }
+  return $line;
+}
+
 function write_table_header ($class, $name, $value, $buttonLink, $ID, $file) {
 
@@ -420,6 +479,14 @@
 }
 
-function write_query_row ($key, $width) {
+// there are two query rows: for strings, only the first is set; for numbers, the first = min, the second = max
+// mode == string, min, max
+function write_query_row ($key, $width, $mode) {
   $htmlkey = preg_replace ('|\.|', '_', $key);
+  if ($mode == 'min') {
+    $htmlkey = $htmlkey . "_min";
+  }
+  if ($mode == 'max') {
+    $htmlkey = $htmlkey . "_max";
+  }
   if ($_SERVER[REQUEST_METHOD] == 'GET') { 
     $value = $_GET[$htmlkey]; 
@@ -427,8 +494,9 @@
     $value = $_POST[$htmlkey];
   }
+  // XXX need to modify $key (should it be htmlkey here?)
   if ($value != "") { 
-    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" size=\"$width\" value=\"$value\"> </td>\n";
-  } else {
-    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" size=\"$width\"> </td>\n";
+    echo "<td class=\"list\"> <input type=\"text\" name=\"$htmlkey\" size=\"$width\" value=\"$value\"> </td>\n";
+  } else {
+    echo "<td class=\"list\"> <input type=\"text\" name=\"$htmlkey\" size=\"$width\"> </td>\n";
   }
 }
Index: trunk/ippMonitor/scripts/generate
===================================================================
--- trunk/ippMonitor/scripts/generate	(revision 18138)
+++ trunk/ippMonitor/scripts/generate	(revision 18143)
@@ -267,5 +267,10 @@
 	$value = $field[$i];
 	if ($value eq "*") { next; }
-	print FILE "\$WHERE = check_restrict ('$value', \$WHERE);\n";
+	if ($format[$i] eq "%s") {
+	    print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'string');\n";
+	} else {
+	    print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'min');\n";
+	    print FILE "\$WHERE = check_restrict ('$value', \$WHERE, 'max');\n";
+	}
     }
     print FILE "\$WHERE = check_ordering (\$WHERE);\n";
@@ -278,6 +283,43 @@
 	$value = $field[$i];
 	if ($value eq "*") { next; }
-	print FILE "\$buttonLink = button_restrict ('$value', \$buttonLink);\n";
-    }
+	if ($format[$i] eq "%s") {
+	    print FILE "\$buttonLink = button_restrict_string ('$value', \$buttonLink);\n";
+	} else {
+	    print FILE "\$buttonLink = button_restrict_min ('$value', \$buttonLink);\n";
+	    print FILE "\$buttonLink = button_restrict_max ('$value', \$buttonLink);\n";
+	}
+    }
+}
+
+# there are two query rows: the first is populated for both strings
+# and numbers, the second only for numbers
+sub write_table_query {
+    my ($i);
+
+    print FILE "echo \"<tr>\\n\";\n";
+    for ($i = 0; $i < @field; $i++) {
+	if ($show[$i] eq "none")  { next; }
+	if ($field[$i] eq "*")  { 
+	    # * fields create an empty cell 
+	    print FILE "echo \"<td> &nbsp; </td>\\n\";\n";
+	} else {
+	    if ($format[$i] eq "%s") {
+		print FILE "write_query_row ('$field[$i]', $width[$i], 'string');\n";
+	    } else {
+		print FILE "write_query_row ('$field[$i]', $width[$i], 'min');\n";
+	    }
+	}
+    }
+    print FILE "echo \"</tr> <tr>\\n\";\n";
+    for ($i = 0; $i < @field; $i++) {
+	if ($show[$i] eq "none")  { next; }
+	if (($field[$i] eq "*") || ($format[$i] eq "%s")) { 
+	    # * fields create an empty cell 
+	    print FILE "echo \"<td class=\\\"list\\\"> &nbsp; </td>\\n\";\n";
+	} else {
+	    print FILE "write_query_row ('$field[$i]', $width[$i], 'max');\n";
+	}
+    }
+    print FILE "echo \"</tr>\\n\";\n";
 }
 
@@ -342,17 +384,4 @@
 }
 
-sub write_table_query {
-    my ($i);
-    for ($i = 0; $i < @field; $i++) {
-	if ($show[$i] eq "none")  { next; }
-	if ($field[$i] eq "*")  { 
-	    # * fields create an empty cell 
-	    print FILE "echo \"<td> &nbsp; </td>\\n\";\n";
-	} else {
-	    print FILE "write_query_row ('$field[$i]', $width[$i]);\n";
-	}
-    }
-}
-
 sub define_fields_string {
     my (@array) = @_;
