PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
It is currently Wed Dec 02, 2015 1:55 am

All times are UTC - 5 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Reports with FPDF.
PostPosted: Fri Dec 10, 2010 7:54 am 
Forum Commoner

Joined: Sun Aug 29, 2010 5:24 am
Posts: 59
Hi all;
I have devolop a php code by looking at some examples on fpdf. What this does is it imports data from a mysql server onto a pdf. Unfortunatley it dosent appear as i wanted. cells are overlapping each other. Does anyone know how to solve this problem? Please refer my attachments.
Syntax: [ Download ] [ Hide ]

$connect = mysql_connect ("localhost","root","") or die ("error");
mysql_select_db ("guestbook") or die ("eroor connecting Database");

$queryget = mysql_query ("select * from report ORDER BY Transaction_Number DESC LIMIT 5" ) or die (" error with table");*/

$todayDate = date('Y-m-d');
$queryget = mysql_query ("select * from report WHERE Date='".$todayDate."' " ) or die (" error with table");

$number_of_products = mysql_numrows($queryget);

$column_Customername = "";
$column_Transaction = "";
$column_Time = "";
$column_Weight = "";
$column_Price = "";
$column_Date ="";
$total = 0;

 while ( $row = mysql_fetch_assoc ($queryget) ){
$id = $row['id'];
  $Customername = $row ['Customer_name'];
  $Transaction_Number = $row ['Transaction_Number'];
  $Price = $row ['Price'];
  $Weight = $row ['Weight'];
  $date = $row ['Date'];
  $time = $row ['Time'];
  $column_Customername = $column_Customername.$Customername."\n";
  $column_Transaction = $column_Transaction.$Transaction_Number."\n";
  $column_Time = $column_Time.$time."\n";
  $column_Weight = $column_Weight.$Weight."\n";
  $column_Price = $column_Price.$Price."\n";
  $column_Date = $column_Date.$date."\n";
  $total = $total+$Price;
  $total1 = $total1+$Weight;

 $pdf=new FPDF();

class PDF extends FPDF
//Page header
function Header()
    //Arial bold 15
    //Move to the right
    //Line break

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

//Instanciation of inherited class
$pdf=new PDF();
    $pdf->Cell(0,10,'Printing line number '.$i,0,1);*/


//Fields Name position
$Y_Fields_Name_position = 40;
//Table position, under Fields Name
$Y_Table_Position = 46;

//First create each Field Name
//Gray color filling each Field Name box


//Bold Font for Field Name
//Now show the 3 columns
$pdf->MultiCell(25,6,'Kg '.$total1,1,'R');
$pdf->MultiCell(25,6,'Rs '.$total,1,'R');

$i = 0;
while ($i < $number_of_products)
    $i = $i +1;



File comment: please have a look on this
mypdf.jpg [ 63.37 KiB | Viewed 3195 times ]
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group