troubleshooting Question

Generate PDF From FPDF PHP

Avatar of anilpotter
anilpotterFlag for India asked on
PHP
13 Comments1 Solution680 ViewsLast Modified:
here is my code i need to input my details how can i insert data from database values in heading and content..
<?php
session_start();
if(!isset($_SESSION['user_id'])) {
header("Location: index.php");
exit();
}

include ('../../includes/dbc.php');
$query="select * from contents where state='1' and (publish_down >= '".date('Y-m-d')."' and publish_up <= '".date('Y-m-d')."') and id='".$_GET['id']."'";
$dataset=mysql_query($query)or die(mysql_error());
$dsRow=mysql_fetch_array($dataset);
?>
<?
require('../fpdf.php');
class PDF extends FPDF
{
//Page header
function Header()
{
      //Logo
      $this->Image('logo.gif',10,8,20);
      //Arial bold 15
      $this->SetFont('Arial','B',15);
      //Move to the right
      $this->Cell(80);
      //Title
      $this->Cell(30,10,Put the title from database?'',0,0,'C');
      //Line break
      $this->Ln(20);
}

//Page footer
function Footer()
{
      //Position at 1.5 cm from bottom
      $this->SetY(-15);
      //Arial italic 8
      $this->SetFont('Arial','I',8);
      //Page number
      $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$pdf->Cell(0,10,'Put the code from database?',0,1);
$pdf->Output();
?>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros