/** * Check if the specified field exists in a given table * @param string $p_field_name a database field name * @param string $p_table_name a valid database table name * @return bool indicating whether the field exists */ function db_field_exists($p_field_name, $p_table_name) { global $g_db; $columns = db_field_names($p_table_name); return in_array($p_field_name, $columns); }
/** * Check if the specified field exists in a given table * @param string $p_field_name A database field name. * @param string $p_table_name A valid database table name. * @return boolean indicating whether the field exists */ function db_field_exists($p_field_name, $p_table_name) { $t_columns = db_field_names($p_table_name); # ADOdb oci8 driver works with uppercase column names, and as of 5.19 does # not provide a way to force them to lowercase if (db_is_oracle()) { $p_field_name = strtoupper($p_field_name); } return in_array($p_field_name, $t_columns); }
# -------------------------------------------------------- require_once 'core.php'; $t_core_path = config_get('core_path'); require_once $t_core_path . 'icon_api.php'; auth_reauthenticate(); access_ensure_global_level(config_get('manage_user_threshold')); $f_sort = gpc_get_string('sort', 'username'); $f_dir = gpc_get_string('dir', 'ASC'); $f_hide = gpc_get_bool('hide'); $f_save = gpc_get_bool('save'); $f_prefix = strtoupper(gpc_get_string('prefix', config_get('default_manage_user_prefix'))); $t_user_table = config_get('mantis_user_table'); $t_cookie_name = config_get('manage_cookie'); $t_lock_image = '<img src="' . config_get('icon_path') . 'protected.gif" width="8" height="15" border="0" alt="' . lang_get('protected') . '" />'; # Clean up the form variables if (!in_array($f_sort, db_field_names($t_user_table))) { $c_sort = 'username'; } else { $c_sort = addslashes($f_sort); } if ($f_dir == 'ASC') { $c_dir = 'ASC'; } else { $c_dir = 'DESC'; } if ($f_hide == 0) { # a 0 will turn it off $c_hide = 0; } else { # anything else (including 'on') will turn it on $c_hide = 1;
/** * Check if the specified field exists in a given table * @param string $p_field_name A database field name. * @param string $p_table_name A valid database table name. * @return boolean indicating whether the field exists */ function db_field_exists($p_field_name, $p_table_name) { $t_columns = db_field_names($p_table_name); return in_array($p_field_name, $t_columns); }