Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showPDF($type)
- {
- $output = '';
- $strSQL = 'SELECT customer_name, course_name, booking_date, booking_time
- FROM booking
- INNER JOIN customer
- ON booking.customer_id = customer.customer_id
- INNER JOIN course
- ON booking.course_id = course.course_id';
- $objQuery = mysql_query($strSQL)or die(mysql_error());
- global $strSQL;
- $i=0;
- $a=0;
- while($objResult = mysql_fetch_array($objQuery)){
- $i++;
- $a++;
- if($i%2==0)
- {
- $bg = "#F5F5F5";
- }
- else
- {
- $bg = "#FFFFFF";
- }
- $output .='
- <tr bgcolor="'.$bg.'" >
- <td width="7%"><div align="center">'.$a.'</div></td>
- <td width="8%"><div align="left">'.$objResult['customer_name'].'</div></td>
- <td width="13%"><div align="left">'.$objResult['course_name'].'</div></td>
- <td width="13%"><div align="left">'.$objResult['booking_date'].'</div></td>
- <td width="22%"><div align="left">'.$objResult['booking_time'].'</div></td>
- </tr>
- ';
- }
- return $output;
- }
- if(isset($_POST["create_pdf"]))
- {
- require_once('tcpdf/tcpdf.php');
- require_once('call/pdfP.php');
- $obj_pdf->SetTitle("#");
- $content .= '
- <table border="1" cellpadding="3" cellspacing="0" width="100%">
- <thead>
- <tr bgcolor="#D3D3D3" color="Black">
- <th width="7%"><div align="center"><B>Customer name</B></div></th>
- <th width="8%"><div align="left"><B>Course name</B></div></th>
- <th width="13%"><div align="left"><B>Booking date</B></div></th>
- <th width="13%"><div align="left"><B>Booking time</B></div></th>
- </tr>
- </thead>
- ';
- $content .= showPDF('pdf');
- $content .= '</table>';
- $content .= $_SESSION['ss_set_pdf'] ;
- $obj_pdf->writeHTML($content);
- ob_end_clean();
- $obj_pdf->Output('vender.pdf', 'I');
- }
Add Comment
Please, Sign In to add comment