buongiorno ragazzi scusate ho bisogno cortesemente del vostro prezziosissimo aiuto , ho questa funzione che mi da un errore
Codice PHP:

function buildCategoryData()
{
    global 
$dbcore ;
    
$categorydata = array();
    
$categorydata $categoryidlist = array();
          
        
$res $dbcore->query("SELECT * FROM `categories` ORDER BY `categoryid` ASC;");

    while (
$key $dbcore->fetch_array($res))
    {
               
        
$catcount count($categorydata[$key["parentcategory"]]);
        
$categorydata[$key["parentcategory"]][$catcount] = $key;
        
$categoryidlist[] = $key["categoryid"];
        
    }
    
$result["categorydata"]    = $categorydata;
    
$result["categoryidlist"]  = $categoryidlist;
    return 
$result;

la riga dell errore e la seguente
codice HTML:
$catcount = count($categorydata[$key["parentcategory"]]);
e mi da questo errore : Notice: Undefined offset: 1 in C:\Program Files\EasyPHP-DevServer-14.1VC11\data\localweb\cms\includes\function_artic les.php on line 120 grazie