Collections functions
General functions
Render functions
Theme permission functions
Resource functions

save_filter()

Description

Save filter, will return existing filter ID if text matches already migrated

Parameters

ColumnTypeDefaultDescription
$filter int - ID of filter
$filter_name int - Name of filter
$filter_condition int - One of RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY

Return

boolean | integer - false, or ID of filter

Location

include/search_functions.php lines 2694 to 2717

Definition

 
function save_filter($filter,$filter_name,$filter_condition)
    {
    if(!
in_array($filter_condition, array(RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY)))
        {
        return 
false;
        }
        
    if(
$filter != 0)
        {    
        if(!
is_numeric($filter))
            {
            return 
false;    
            }
        
ps_query("UPDATE filter SET name=?, filter_condition=? WHERE ref = ?",array("s",$filter_name,"s",$filter_condition,"i",$filter));
        }
    else
        {
        
$newfilter ps_query("INSERT INTO filter (name, filter_condition) VALUES (?,?)",array("s",$filter_name,"s",$filter_condition));
        
$newfilter sql_insert_id();
        return 
$newfilter;
        }

    return 
$filter;
    }

This article was last updated 30th September 2022 16:05 Europe/London time based on the source file dated 13th September 2022 17:55 Europe/London time.