fetchall(PDO)结果集迭代不返回$ key => $ value的值

I am trying to iterate through the resultset and get the column names and the values,for exporting the data using PHPExcel, but the $qVistadet->fetchall is not working in the below code, and gets errors like undefined offset.

But$qVistadet->fetch, works but as it only returns the first row in the resultset, it is not useful.

Could anyone help on the issue?

    $qVistadet = $db->prepare("CALL spvistadetailsbystaffid(?)");
    $qdetails->bindParam (1, $staffid);
    $qdetails->execute();

        $col=0;
        $row1=1;

        while($row = $qVistadet->fetchAll(PDO::FETCH_ASSOC))
           {
        foreach ($row as $key=>$value)
              {         
                $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, 1, $key);
                $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row1 + 1, $value);
                $col++;
              }
            $row1++;
           }

The below change fixed the issue. Thanks.

$qVistadet = $db->prepare( "CALL spvistadetailsbystaffid(?)" );
$qVistadet->bindParam ( 1, $staffid );
$qVistadet->execute();


$col=0;
$row1=2;
while ($arrValues = $qVistadet->fetch(PDO::FETCH_ASSOC))
    {

        foreach ($arrValues as $key=>$value){

            $sheet->setCellValueByColumnAndRow($col, 1, $key);
            $sheet->setCellValueByColumnAndRow($col, $row1, $value);
            $col++;
            }
        $row1++;
        $col=0;
    }