Location: PHPKode > scripts > Admidio > admidio-2.2.9/adm_install/db_scripts/upd_2_2_8_conv.php
<?php
/******************************************************************************
 * Datenkonvertierung fuer die Version 2.2.8
 *
 * Copyright    : (c) 2004 - 2011 The Admidio Team
 * Homepage     : http://www.admidio.org
 * License      : GNU Public License 2 http://www.gnu.org/licenses/gpl-2.0.html
 *
 *****************************************************************************/
 
// Reihenfolge der Kategorien noch einmal komplett neu vergeben
$sql = 'SELECT * FROM '. TBL_ORGANIZATIONS;
$result_orga = $g_db->query($sql);

while($row_orga = $g_db->fetch_array($result_orga))
{
    $last_cat_type = '';
    $counter       = 0;
    $sql = 'SELECT * FROM '. TBL_CATEGORIES. ' 
             WHERE (  cat_org_id = '. $row_orga['org_id']. '
                   OR cat_org_id IS NULL )
             ORDER BY cat_type, cat_org_id, cat_sequence ';
    $result_cat = $g_db->query($sql);

    while($row_cat = $g_db->fetch_array($result_cat))
    {
        if($row_cat['cat_type'] != $last_cat_type)
        {
            $counter = 1;
            $last_cat_type = $row_cat['cat_type'];
        }

        $sql = 'UPDATE '. TBL_CATEGORIES. ' SET cat_sequence = '. $counter. '
                 WHERE cat_id = '. $row_cat['cat_id'];
        $g_db->query($sql);
        
        $counter++;
    } 
}

?>
Return current item: Admidio