TCPDF ERROR: Some data has already been output, can’t send PDF file

I keep receiving this error when trying to add my own array into the code. Here is my array;

$array = array();

while (odbc_fetch_row($rs))
{
$array[] = odbc_result($rs,'Product Name');
} 
$test = print_r($array);

The original code is here. I’m using an example page to try it because I know the example page works fine.

http://www.tcpdf.org/examples/example_001.phps

This code is before the $html variable and when it is set I just add the $test variable into the $html variable. The odbc connection works fine and the example works fine before I add any code but when I run the script I get this error;

Array ( [0] => Test1 [1] => Test2 ) TCPDF ERROR: Some data has already been output, can't send PDF file

And there is also more than 2 items in the Array. Any ideas?

Leave a Comment