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

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

Postby DelPazzo » Thu Jan 06, 2011 10:02 am

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:

Syntax: [ Download ] [ Hide ]
//example:
$pdf->Cell(0,0,'69, Route d'Esch');
Last edited by DelPazzo on Thu Jan 06, 2011 1:47 pm, edited 1 time in total.
DelPazzo
Forum Newbie
 
Posts: 23
Joined: Thu Dec 30, 2010 4:49 am

Re: fpdf problems with commas and/or apostrophes

Postby Jade » Thu Jan 06, 2011 11:37 am

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

Syntax: [ Download ] [ Hide ]
$pdf->Cell(0,0,'69, Route d\'Esch');
 
User avatar
Jade
Forum Regular
 
Posts: 908
Joined: Sun Dec 29, 2002 6:40 pm
Location: VA

Re: fpdf problems with commas and/or apostrophes

Postby DelPazzo » Thu Jan 06, 2011 1:46 pm

thx that helped. ;)
DelPazzo
Forum Newbie
 
Posts: 23
Joined: Thu Dec 30, 2010 4:49 am


Return to PHP - Code

Who is online

Users browsing this forum: No registered users and 19 guests