Advertisement
Guest User

Untitled

a guest
Feb 27th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. require('fpdf.php');
  3. $dbServername = "localhost";
  4. $dbUsername ="root";
  5. $dbPassword ="";
  6. $dbName="authenticdb";
  7.  
  8.  
  9. $conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);
  10. $pdf = new FPDF();
  11. ///var_dump(get_class_methods($pdf));
  12. $pdf->AddPage();
  13.  
  14. $pdf->SetFont('Arial','',10);
  15. $pdf->Cell(50,10,'Date:'.date('d-m-Y').'',0,"R");
  16. $pdf->Ln(15);
  17. $pdf->SetFont('Arial','B',16);
  18. $pdf->Cell(0,10,'Products',1,1,"C");
  19. $pdf->SetFont('Arial','B',12);
  20. $pdf->Cell(15,8,'No.',1);
  21. $pdf->Cell(40,8,'Menu ID',1);
  22. $pdf->Cell(45,8,'Name',1);
  23. $pdf->Cell(45,8,'Buying Price',1);
  24. $pdf->Cell(45,8,'Selling Price',1);
  25.  
  26. $query="SELECT * FROM menu";
  27. $result = mysqli_query($conn, $query);
  28. $no=0;
  29. while($row = mysqli_fetch_array($result)){
  30. $no=$no+1;
  31. $pdf->Ln(8);
  32. $pdf->SetFont('Arial','',12);
  33. $pdf->Cell(15,8,$no,1);
  34. $pdf->Cell(40,8,$row['product_id'],1);
  35. $pdf->Cell(45,8,$row['product_name'],1);
  36. $pdf->Cell(45,8,$row['product_price'],1);
  37. $pdf->Cell(45,8,$row['product_serving'],1);
  38. }
  39. $pdf->Output();
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement