I have a php code
as shown below in which I am getting the error Undefined variable at Line A
in the file document.php
while ($row = $this->m_PointsDAO->getRow()) {
$pointList[] = $row[0];
}
$voOwnerpointList = [];
foreach ($pointList as $positionName) { // Line A
$voOwnerpointList[] = $this->m_PointsDAO->getPositionByName($positionName);
}
Problem Statement: I am wondering what changes I need to do at Line A so that I am can avoid the undefined variable error notice.
This is what I have tried. I have added Line B
in order to solve the problem in the file document.php
while ($row = $this->m_PointsDAO->getRow()) {
$pointList[] = $row[0];
}
$voOwnerpointList = [];
$pointList = []; // Line B
foreach ($pointList as $positionName) { // Line A
$voOwnerpointList[] = $this->m_PointsDAO->getPositionByName($positionName);
}