Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

update_collection_order()

Parameters

ColumnTypeDefaultDescription
$neworder
$collection
$offset 0

Location

include/collections_functions.php lines 1866 to 1882

Definition

 
function update_collection_order($neworder,$collection,$offset=0)
    {    
    if (!
is_array($neworder)) {
        exit (
"Error: invalid input to update collection function.");
    }

    
$updatesql"update collection_resource set sortorder=(case resource ";
    
$counter $offset;
    foreach (
$neworder as $colresource){
        
$updatesql.= "when '" escape_check($colresource) . "' then '$counter' ";
        
$counter++;
    }
    
$updatesql.= "else sortorder END) WHERE collection='" escape_check($collection) . "'";
    
sql_query($updatesql);
    
$updatesql="update collection_resource set sortorder=99999 WHERE collection='" escape_check($collection) . "' and sortorder is NULL";
    
sql_query($updatesql);
    }

This article was last updated 7th July 2020 09:05 Europe/London time based on the source file dated 3rd July 2020 14:33 Europe/London time.