fpdf problems with commas and/or apostrophes (RESOLVED!)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DelPazzo
Forum Newbie
Posts: 23
Joined: Thu Dec 30, 2010 3:49 am

fpdf problems with commas and/or apostrophes (RESOLVED!)

Post by DelPazzo »

Hi,

I'm setting up an fpdf script where I use lots of variables. Some contain commas (,) and apostrophes (') when using these strings in the command cell() I get an unexpected t_string error.
I'm not sure but I think it's the apostrophe that triggers the error.

How can I bypass that?

Examples for such commands:

Code: Select all

//example:
$pdf->Cell(0,0,'69, Route d'Esch');
Last edited by DelPazzo on Thu Jan 06, 2011 12:47 pm, edited 1 time in total.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: fpdf problems with commas and/or apostrophes

Post by Jade »

I've never had problems with commas before but you have to escape the apostrophes:

Code: Select all

$pdf->Cell(0,0,'69, Route d\'Esch');
DelPazzo
Forum Newbie
Posts: 23
Joined: Thu Dec 30, 2010 3:49 am

Re: fpdf problems with commas and/or apostrophes

Post by DelPazzo »

thx that helped. ;)
Post Reply