Search code examples
phpsqlodbcfpdf

ODBC_result_all bad print


I'm actually working on a database SQL Server on Windows. I access it with ODBC in PHP. I use FPDF because I want to print mySQL answer on a PDF who's generate when I launch my code.

That's a bit of my code:

$rs=odbc_exec ($connection, $query);
$print=odbc_result_all($rs, "cellpadding= '3' background-color = 'd3d3d3'");
/////
$pdf->Write(20,$print);
$pdf->Text(100,100,$print);

First of all, I can print the SQL answer on my web page and I can print text on my PDF.

So I want to print the SQL answer on the PDF, but when I execute my code, he prints the number of results...

I don't understand why. Maybe that's a type problem?


Solution

  • It is converting in HTML so you have to use

    $pdf->WriteHTML($print)
    

    Something like above for HTML data.