I'm trying to get some data from server with the help of php script, that looks like:
$count_list = array();
while($row = $result->fetch_assoc()){
$count_list[$row['index']][$row['id']] = $row['count'];
}
$result->close();
for($i = 1; $i < 5; $i++){
if($count_list[$i] === null || $count_list[$i][CONTENT_ID1] === null){
$count_list[$i][CONTENT_ID1] = 0;
}
if($count_list[$i] === null || $count_list[$i][CONTENT_ID2] === null){
$count_list[$i][CONTENT_ID2] = 0;
}
if($count_list[$i] === null || $count_list[$i][CONTENT_ID3] === null){
$count_list[$i][CONTENT_ID3] = 0;
}
$_smarty->assign("p".$i."c", min($count_list[$i][CONTENT_ID1], $count_list[$i][CONTENT_ID2], $count_list[$i][CONTENT_ID3]));
}
I'm getting "undefined offset", "undefined index" Notices. As you can see, I even added some checks inside for-loop to ensure, that there will be no null values for min() function, but then the same Notices are showing right at those check lines. What am I doing wrong, and how should I get rid of those Notices. I just want, every non-existing element of my array to be 0. thanks in advance.