0

Good day all , I've made a php script that extracts some data from a mysql table and creates a PDF with it.It works but some of the words have a '?' instead of the letters 'ș','ț','î','ă','î','â'.I don't know what causes that, I used FPDF library. Here is the code :

<?php
require('mysql_table.php');


class PDF extends PDF_MySQL_Table
{
function Header()
{
    //Title
    $this->SetFont('Arial','',18);
    $this->Cell(0,6,'Titlu',0,1,'C');
    $this->Ln(10);
    //Table header
    parent::Header();
}

}


//Connect to the database
mysql_connect('localhost','root','');
mysql_select_db('dct_2015_2016');


$pdf=new PDF();
$pdf->AddPage();




   //Table
$pdf->AddCol('semestru',20,'Semestru','C');
$pdf->AddCol('facultate',40,'Facultate');
$pdf->AddCol('opt_id',20,'Optiune','C');
$pdf->AddCol('disciplina',100,'Disciplina','L');
$pdf->AddCol('cati_au_ales',20,'Persoane','C');
$prop=array('HeaderColor'=>array(255,150,100),
            'color1'=>array(210,245,255),
            'color2'=>array(255,255,210),
            'padding'=>2);
$pdf->Table('select semestru,facultate,opt_id,disciplina,cati_au_ales from nr_optiuni order by semestru',$prop);
$pdf->Output();
?>

If I run the SELECT from mySql Admin the data is displayed correct , with the special characters.

Alexandru Ianas
  • 95
  • 1
  • 11
  • wrong encoding? those letters are not within your font-file? ... – donald123 Jul 21 '15 at 12:24
  • Please do not use the `mysql_` libraries as [they are deprecated and will be removed from PHP](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – Machavity Jul 21 '15 at 12:25
  • @Alexandru Ianas, when you run the same select statement from your MySQL IDE, how is data retrieved? Does it contain the special characters ? Just to confirm and eliminate a potential cause.. – Eduard Uta Jul 21 '15 at 12:26
  • @EduardUta If I run the select from my my SQL IDE, data is retrieved fine, without the '?' . – Alexandru Ianas Jul 21 '15 at 12:37

0 Answers0