Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set("session.auto_start", 0);
- require('fpdf.php');
- //create a FPDF object
- $pdf = new FPDF();
- //set font for the entire document
- $pdf->SetFont('Helvetica','B',20);
- //$pdf->SetTextColor(50,60,100);
- //set up a page
- $pdf->AddPage('P');
- $pdf->SetDisplayMode('default');
- //insert an image and make it a link
- $pdf->Image('img/logo1.png',70,10,65,0);
- //display the title with a border around it
- $pdf->SetXY(40,30);
- $pdf->SetDrawColor(50,60,100);
- $pdf->Write(10,'Baby Destination Customized Reports',0,'C',0);
- $pdf->Line(10,40,200,40);
- //Set x and y position for the main text, reduce font size and write content
- $pdf->SetXY (20,45);
- $pdf->SetFontSize(10);
- $pdf->SetTextColor(30,30,100);
- $pdf->Write(5,'As per current time');
- $host = "babydestination-magento.cps4gu5q1b8f.us-west-2.rds.amazonaws.com";
- $username = "abc";
- $password = "abc";
- $db_name = "abc";
- $con = @mysqli_connect($host,$username,$password);
- mysqli_select_db($con,$db_name);
- $sql = "SELECT count(*) FROM report where event_type_id=1";
- $pos = 0;
- $pos2 = 60;
- $i = 0;
- $result = mysqli_query($con,$sql);
- while ($rows= (mysqli_fetch_array($result,MYSQLI_ASSOC))) {
- if ($i==6) {
- $pos2 = $pos2 + 25;
- $pos=0;
- }
- $sno = $rows['count(*)'];
- $pdf->SetXY (20+$pos,$pos2);
- $pdf->SetFontSize(12);
- $pdf->SetTextColor(0,0,0);
- $pdf->Write(7,$sno);
- $pdf->Ln();
- $pos = $pos + 30;
- $i = $i + 1;
- }
- ob_clean();
- flush();
- $pdf->Output('customized_report.pdf','I');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement