0

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?

Opsse
  • 1,851
  • 2
  • 22
  • 38
Romain
  • 5
  • 7

1 Answers1

0

It is converting in HTML so you have to use

$pdf->WriteHTML($print)

Something like above for HTML data.

pspatel
  • 508
  • 2
  • 7
  • 18
  • Thanks for your answer, however, FPDF doesn't have a "WriteHTML" like. I'll try with another librairies, FTPDF has that method if I remember well. – Romain May 22 '18 at 13:18
  • @Romain you can create function something like this reference from fpdf site http://www.fpdf.org/en/script/script42.php or you may use other options like mpdf, tcpdf etc. – pspatel May 22 '18 at 13:20
  • I just saw it yes! I think it's the only solution if I want to continue to using FPDF – Romain May 22 '18 at 13:28
  • If you are in the initial stage of development you may change because may in future another thing will cause an issue in development. – pspatel May 22 '18 at 13:35
  • Oh okay, what do you recommend? Or maybe they're all with the same "level"? – Romain May 22 '18 at 13:45
  • I use FTPDF now, I used writeHTML() but it continues to print the number of results, I really don't understand – Romain May 23 '18 at 06:40