Solution for PHP Notice: Undefined index: internalid [closed]

2

I do not understand what is wrong with this code

//$expense_categories = explode(chr(13), $row[expense_categories]);
$categoryResult=mysqli_query($db,"SELECT category_id,category FROM expense_categories order by category_id");
if(mysqli_num_rows($categoryResult) > 0){
//echo mysqli_num_rows($categoryResult)."<br/><br/>\n";
    while($catrow = mysqli_fetch_assoc($categoryResult)){
        //echo $catrow["internalid"],"  ",$catrow["category"]."<br/>";
        $expense_categories[$catrow["internalid"]]=$catrow["category_id"]; //Linea 14
    }
}

Error in log:

  

PHP Notice: Undefined index: internalid in   /var/www/misitio.org/cc/config.inc on line 14, referer:    link

    
asked by Martini002 30.03.2017 в 20:25
source

1 answer

1

The Error is simple, you can not access the Index internalid given that it is not part of your query SELECT , you can only access the Indices that you call in your query. That is, $catrow["category "] and $catrow["category_id"]

    
answered by 30.03.2017 / 20:35
source