'Serialized Arrray in TCPDF not showing properly

Good Day

I have a serialized array having records in MYSQL When I display them browser, results are fine (by unserializing and displaying) When I show in TCPDF, it returns only one record (total are 2 3 records)

I am putting them in loop and using same logic as using in browser too

Below is the code I am trying in TCPDF

Thanks

$query1 = "SELECT * from fine_controls WHERE formid='$emp_id'";
        $resulty = mysqli_query($link, $query1);
        

        while($row22 = mysqli_fetch_assoc($resulty)){
            $fine_typesR = unserialize($row22['fine_type']);
        }
    foreach ($fine_typesR as $fine_typet) { $f= $fine_typet;    }
  $pdf->writeHTML($f, true, false, false, false, '');

Above code shows only one value suppose values are 3 and 7 I get only one record 3. I don't know why is this happening

Thanks



Solution 1:[1]

As KenLee said, Put $pdf->writeHTML in loop too so it worked

Thanks

$query1 = "SELECT * from fine_controls WHERE formid='$emp_id'";
        $resulty = mysqli_query($link, $query1);
        

        while($row22 = mysqli_fetch_assoc($resulty)){
            $fine_typesR = unserialize($row22['fine_type']);
        }
    foreach ($fine_typesR as $fine_typet) { $f= $fine_typet;    
  $pdf->writeHTML($f, true, false, false, false, '');

}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MAZHAR IQBAL RANA