Hello,
Pls help me with this.
I want to output data from database(mySql) .Output them in pdf form using FPDF (like a report). My problem is that, Not all the data from the db are being outputted. Just a first(5 cells) is showing. I dont know how to fix this anymore. pls help me..am just a newbie.
Here is my code....
Pls help me with this.
I want to output data from database(mySql) .Output them in pdf form using FPDF (like a report). My problem is that, Not all the data from the db are being outputted. Just a first(5 cells) is showing. I dont know how to fix this anymore. pls help me..am just a newbie.
Here is my code....
Code:
<?php
require('fpdf.php');
class PDFz extends FPDF
{
function Header()
{
global $title;
$this->Image('logo.jpg',10,20,33,0,'','http://www.websolutionnetwork.com/');
$this->SetFont('Arial', 'B', 20);
$this->SetFillColor(36, 96, 84);
$this->SetTextColor(28,134,238);
$this->Cell(0, 10, "", 0, 1, 'C', false);
$this->Cell(0, 5, "", 0, 1, 'C', false);
$this->SetFont('Arial','',18);
$this->Cell(0,6,'Web Solution Network Client Detail',0,1,'C');
$this->SetFont('Arial','',9);
$this->Cell(150,10,'DATE: '.date('d-m-y'),0,1,'L');
$this->SetAuthor(0,6,'Gurjit Singh',0,1,'C');
$this->Ln(10);
//Ensure table header is output
parent::Header();
}
// 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');
}
}
$pdf = new PDFz();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,6,'No:',1,0,'C');
$pdf->Cell(40,6,'Client Name',1,0,'C');
$pdf->Cell(40,6,'Place',1,0,'C');
$pdf->Cell(40,6,'Id Person',1,0,'C');
$pdf->Cell(40,6,'On/Off/dispute',1,0,'C');
$pdf->Cell(40,6,'Paid/Panding',1,0,'C');
$pdf->Cell(40,6,'Star',1,0,'C');
$pdf->Cell(40,6,'Comment',1,0,'C');
$pdf->Cell(40,6,'Month',1,0,'C');
$pdf->Cell(40,6,'Total Payment',1,0,'C');
$pdf->Cell(40,6,'Cut fee',1,0,'C');
$pdf->Cell(40,6,'Rupees',1,0,'C');
$pdf->Cell(40,6,'Client Email',1,0,'C');
$pdf->Cell(40,6,'Client Skype',1,0,'C');
$pdf->ln();
$mysqli = new mysqli("localhost", "root", "", "account");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$pdf->SetFont('Arial','',12);
$query = $mysqli->query("SELECT * FROM client_entry ORDER BY 1 DESC");
while($row = $query->fetch_array(MYSQLI_ASSOC)){
$pdf->Cell(40,6,$row['client_id'],1,0,'C');
$pdf->Cell(40,6,$row['client_name'],1,0,'L');
$pdf->Cell(40,6,$row['dev_place'],1,0,'L');
$pdf->Cell(40,6,$row['dev_name'],1,0,'L');
$pdf->Cell(40,6,$row['client_status'],1,0,'L');
$pdf->Cell(40,6,$row['client_payment'],1,0,'L');
$pdf->Cell(40,6,$row['client_star'],1,0,'L');
$pdf->Cell(40,6,$row['client_comment'],1,0,'L');
$pdf->Cell(40,6,$row['entry_month'],1,0,'L');
$pdf->Cell(40,6,$row['total_payment'],1,0,'L');
$pdf->Cell(40,6,$row['cut_fee'],1,0,'L');
$pdf->Cell(40,6,$row['total_rupees'],1,0,'L');
$pdf->Cell(40,6,$row['client_email'],1,0,'L');
$pdf->Cell(40,6,$row['client_skype'],1,0,'L');
$pdf->ln();
}
$pdf->Output();
?>