Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_grouped_related_keywords()

Parameters

ColumnTypeDefaultDescription
$find ""
$specific ""

Location

include/search_functions.php lines 2451 to 2477

Definition

 
function get_grouped_related_keywords($find="",$specific="")
    {
    
debug_function_call("get_grouped_related_keywords"func_get_args());

    
# Returns each keyword and the related keywords grouped, along with the resolved keywords strings.
    
$sql="";$params=array();

    if (
$find!="")
        {
        
$sql="where k1.keyword=? or k2.keyword=?";
        
$params[]="s";$params[]=$find;
        
$params[]="s";$params[]=$find;
        }
    if (
$specific!="")
        {
        
$sql="where k1.keyword=?";
        
$params[]="s";$params[]=$specific;
        }
    
    return 
ps_query("
        select k1.keyword,group_concat(k2.keyword order by k2.keyword separator ', ') related from keyword_related kr
            join keyword k1 on kr.keyword=k1.ref
            join keyword k2 on kr.related=k2.ref
        
$sql
        group by k1.keyword order by k1.keyword
        "
,$params);
    }

This article was last updated 4th October 2022 10:05 Europe/London time based on the source file dated 3rd October 2022 17:20 Europe/London time.