Hi
Wanted to utilize the php/mysql insert into the FPDI pdf export tool. I have it working just as plain text which is nice. But, i'd like to to have mysql place db entries into it.
I've declared my sql connection, just using dreamweaver at the moment.
I'm struggling to get the php to execute and echo the correct values.

As you can see below, the Plain text entry works, but i the php echo not so much. Is it just my formatting?

<?php require_once('../Connections/Est2023_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
$rs_pdf = new WA_MySQLi_RS("rs_pdf",$Est2023_i,1);
$rs_pdf->setQuery("SELECT * FROM main");
$rs_pdf->execute();
?>
<?php
use setasign\Fpdi\Fpdi;


require_once('pdf/fpdf.php');
require_once('pdf/autoload.php');


// initiate FPDI
$pdf = new Fpdi();
// add a page
$pdf->AddPage();
// set the source file
$pdf->setSourceFile('sourcefile.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at position 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 0, 0, 210);


// now write some text above the imported page
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY(50, 115);
$pdf->Write(0, "<?php echo($rs_pdf->getColumnVal("building")); ?>");


// now write some text above the imported page - line 2
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(0, 0, 0);
$pdf->SetXY(50, 122);
$pdf->Write(0, 'Plain text entry');


$pdf->Output('I', 'myfilename.pdf');

Sorry for taking so long to see this. I wasn't near my computer over this past weekend.

However, line 32 should simply be:

$pdf->Write(0, $rs_pdf->getColumnVal("building"));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.