Advertisement
Guest User

Untitled

a guest
Jul 11th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <?php
  2. ini_set("session.auto_start", 0);
  3. require('fpdf.php');
  4.  
  5. //create a FPDF object
  6. $pdf = new FPDF();
  7.  
  8. //set font for the entire document
  9. $pdf->SetFont('Helvetica','B',20);
  10. //$pdf->SetTextColor(50,60,100);
  11.  
  12. //set up a page
  13. $pdf->AddPage('P');
  14. $pdf->SetDisplayMode('default');
  15.  
  16. //insert an image and make it a link
  17. $pdf->Image('img/logo1.png',70,10,65,0);
  18.  
  19. //display the title with a border around it
  20. $pdf->SetXY(40,30);
  21. $pdf->SetDrawColor(50,60,100);
  22. $pdf->Write(10,'Baby Destination Customized Reports',0,'C',0);
  23. $pdf->Line(10,40,200,40);
  24.  
  25. //Set x and y position for the main text, reduce font size and write content
  26. $pdf->SetXY (20,45);
  27. $pdf->SetFontSize(10);
  28. $pdf->SetTextColor(30,30,100);
  29. $pdf->Write(5,'As per current time');
  30.  
  31. $host = "babydestination-magento.cps4gu5q1b8f.us-west-2.rds.amazonaws.com";
  32. $username = "abc";
  33. $password = "abc";
  34. $db_name = "abc";
  35. $con = @mysqli_connect($host,$username,$password);
  36. mysqli_select_db($con,$db_name);
  37.  
  38. $sql = "SELECT count(*) FROM report where event_type_id=1";
  39.  
  40. $pos = 0;
  41. $pos2 = 60;
  42. $i = 0;
  43.  
  44. $result = mysqli_query($con,$sql);
  45.  
  46. while ($rows= (mysqli_fetch_array($result,MYSQLI_ASSOC))) {
  47.  
  48. if ($i==6) {
  49. $pos2 = $pos2 + 25;
  50. $pos=0;
  51. }
  52. $sno = $rows['count(*)'];
  53.  
  54. $pdf->SetXY (20+$pos,$pos2);
  55. $pdf->SetFontSize(12);
  56. $pdf->SetTextColor(0,0,0);
  57. $pdf->Write(7,$sno);
  58. $pdf->Ln();
  59. $pos = $pos + 30;
  60.  
  61. $i = $i + 1;
  62. }
  63.  
  64. ob_clean();
  65. flush();
  66. $pdf->Output('customized_report.pdf','I');
  67. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement