Hi, I am getting a PHP Warning of undefined array key on the following line. Wondering how I can adjust this function to get the warning to go away?
which is inside the following function
PHP:
$rows[$key] = $row['id'];
which is inside the following function
PHP:
function getWorkingPapers() {
if(get_field('working-papers', 33)) {
$paperCounter = 0;
$rows = get_field('working-papers', 33);
$rowCount = count($rows);
$workingPapers = '<ul class="download-list">';
$paperArray = array();
foreach($rows as $key => $row) {
$rows[$key] = $row['id'];
$paperArray[$key]['title'] = $row['title'];
$paperArray[$key]['author'] = $row['author'];
$paperArray[$key]['file'] = $row['file'];
}
$rowCount = count($rows); $paperNO = $rowCount;
for ($i = ($rowCount - 1); $i >= 0; $i--) {
if ($paperCounter <= 2) {
$workingPapers .= '<li>';
$workingPapers .= '<a target="_blank" href="'.$paperArray[$i]['file'].'">';
$workingPapers .= '<b class="number">'.$paperNO--.'.</b>';
$workingPapers .= '<p>“'.$paperArray[$i]['title'].'”</p>';
$workingPapers .= '<strong class="name">'.$paperArray[$i]['author'].'</strong>';
$workingPapers .= '</a>';
$workingPapers .= '</li>';
}
$paperCounter++;
}
$workingPapers .= '</ul>';
}
return $workingPapers;
}