Guest User

Untitled

a guest
Jul 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. function showPDF($type)
  2. {
  3. $output = '';
  4. $strSQL = 'SELECT customer_name, course_name, booking_date, booking_time
  5. FROM booking
  6.  
  7. INNER JOIN customer
  8. ON booking.customer_id = customer.customer_id
  9.  
  10. INNER JOIN course
  11. ON booking.course_id = course.course_id';
  12.  
  13. $objQuery = mysql_query($strSQL)or die(mysql_error());
  14. global $strSQL;
  15. $i=0;
  16. $a=0;
  17. while($objResult = mysql_fetch_array($objQuery)){
  18. $i++;
  19. $a++;
  20. if($i%2==0)
  21. {
  22. $bg = "#F5F5F5";
  23. }
  24. else
  25. {
  26. $bg = "#FFFFFF";
  27. }
  28. $output .='
  29. <tr bgcolor="'.$bg.'" >
  30. <td width="7%"><div align="center">'.$a.'</div></td>
  31. <td width="8%"><div align="left">'.$objResult['customer_name'].'</div></td>
  32. <td width="13%"><div align="left">'.$objResult['course_name'].'</div></td>
  33. <td width="13%"><div align="left">'.$objResult['booking_date'].'</div></td>
  34. <td width="22%"><div align="left">'.$objResult['booking_time'].'</div></td>
  35. </tr>
  36. ';
  37. }
  38. return $output;
  39. }
  40.  
  41. if(isset($_POST["create_pdf"]))
  42. {
  43. require_once('tcpdf/tcpdf.php');
  44. require_once('call/pdfP.php');
  45. $obj_pdf->SetTitle("#");
  46.  
  47. $content .= '
  48. <table border="1" cellpadding="3" cellspacing="0" width="100%">
  49. <thead>
  50. <tr bgcolor="#D3D3D3" color="Black">
  51. <th width="7%"><div align="center"><B>Customer name</B></div></th>
  52. <th width="8%"><div align="left"><B>Course name</B></div></th>
  53. <th width="13%"><div align="left"><B>Booking date</B></div></th>
  54. <th width="13%"><div align="left"><B>Booking time</B></div></th>
  55. </tr>
  56. </thead>
  57. ';
  58. $content .= showPDF('pdf');
  59. $content .= '</table>';
  60. $content .= $_SESSION['ss_set_pdf'] ;
  61. $obj_pdf->writeHTML($content);
  62. ob_end_clean();
  63. $obj_pdf->Output('vender.pdf', 'I');
  64. }
Add Comment
Please, Sign In to add comment