function search_grid($foper, $fldatas) { $fldata = admlib::Strip($fldatas); $exp_items = explode(",", $fldata); $i = 1; while (list(, $v) = each($exp_items)) { if ($i != count($exp_items)) { $c = ","; } if ($i == count($exp_items)) { $c = ""; } $xfield .= "'" . $v . "'" . $c; $i++; } switch (admlib::Strip($foper)) { case "bw": //$fldata .= "%"; $where .= " LIKE '" . $fldata . "%'"; break; case "bn": //$fldata .= "%"; $where .= " NOT LIKE '" . $fldata . "%'"; break; case "eq": if (is_numeric($fldata)) { $where .= " = " . $fldata; } else { $where .= " = '" . $fldata . "'"; } break; case "ne": if (is_numeric($fldata)) { $where .= " <> " . $fldata; } else { $where .= " <> '" . $fldata . "'"; } break; case "lt": if (is_numeric($fldata)) { $where .= " < " . $fldata; } else { $where .= " < '" . $fldata . "'"; } break; case "le": if (is_numeric($fldata)) { $where .= " <= " . $fldata; } else { $where .= " <= '" . $fldata . "'"; } break; case "gt": if (is_numeric($fldata)) { $where .= " > " . $fldata; } else { $where .= " > '" . $fldata . "'"; } break; case "ge": if (is_numeric($fldata)) { $where .= " >= " . $fldata; } else { $where .= " >= '" . $fldata . "'"; } break; case "ew": $where .= " LIKE '%" . $fldata . "'"; break; case "en": $where .= " NOT LIKE '%" . $fldata . "'"; break; case "cn": $where .= " LIKE '%" . $fldata . "%'"; break; case "nc": $where .= " NOT LIKE '%" . $fldata . "%'"; break; case "in": $where .= " IN (" . $xfield . ")"; break; case "ni": $where .= " NOT IN (" . $xfield . ")"; break; default: $where = "WHERE 1=1"; } return $where; }