show me how to fix this error , although there are quite a few posts but mine is a bit different . I don't understand php well thanks ! details of the error code line: $datainfo['category'] = $category['name'];
The error states that PHP cannot find the key "name" in an array. To counteract the error, you can make the following check and assignment at the point where the array is set.
Many ways to do it:
long version
if (! isset($category['name'])) {
$category['name'] = "";
}
medium long version
$datainfo['category'] = (isset($category['name'])) ? $category['name'] : "";
shortest version
$datainfo['category'] = $category['name'] ?? "";