Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('fpdf.php');
- $dbServername = "localhost";
- $dbUsername ="root";
- $dbPassword ="";
- $dbName="authenticdb";
- $conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);
- $pdf = new FPDF();
- ///var_dump(get_class_methods($pdf));
- $pdf->AddPage();
- $pdf->SetFont('Arial','',10);
- $pdf->Cell(50,10,'Date:'.date('d-m-Y').'',0,"R");
- $pdf->Ln(15);
- $pdf->SetFont('Arial','B',16);
- $pdf->Cell(0,10,'Products',1,1,"C");
- $pdf->SetFont('Arial','B',12);
- $pdf->Cell(15,8,'No.',1);
- $pdf->Cell(40,8,'Menu ID',1);
- $pdf->Cell(45,8,'Name',1);
- $pdf->Cell(45,8,'Buying Price',1);
- $pdf->Cell(45,8,'Selling Price',1);
- $query="SELECT * FROM menu";
- $result = mysqli_query($conn, $query);
- $no=0;
- while($row = mysqli_fetch_array($result)){
- $no=$no+1;
- $pdf->Ln(8);
- $pdf->SetFont('Arial','',12);
- $pdf->Cell(15,8,$no,1);
- $pdf->Cell(40,8,$row['product_id'],1);
- $pdf->Cell(45,8,$row['product_name'],1);
- $pdf->Cell(45,8,$row['product_price'],1);
- $pdf->Cell(45,8,$row['product_serving'],1);
- }
- $pdf->Output();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement