Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
387 views
in Technique[技术] by (71.8m points)

php - FPDF setting 2 consecutive values in one cell

I just need to find out how to set 2 values from MySQL database in a FPDF. The values will be consecutive with a 'dash' in between them. Here is an example of what I want to do.

$pdf->Cell(110, 7,$address1 ' - ', $address2);
question from:https://stackoverflow.com/questions/65557744/fpdf-setting-2-consecutive-values-in-one-cell

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are using a comma but should be using the dot '.'. FPF is seeing these as different arguments separated by commas.

// this will work (note the dots instead of the comma)
$pdf->Cell(110, 7,$address1 . ' - ' . $address2);

// I prefer this: it is easier to read
$fullAddress = $address1 . ' - ' . $address2;
$pdf->Cell(110, 7,$fullAddress);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...