I have the following PHP file course.php, which I would like dompdf to render the file. However, when I try to load the external file it tells me headers already loaded.
I have tried some of the tutorials online however when I add inline php the pdf does not render appropriately.
Is there anyway possible to add an external php file?
<?php
include config.php
$course_id= JRequest::getInt('cid');
$dbname = "i2894069_jos2";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT en . * , e.full_name, e.level , c.base_level, s.station
FROM enrolled_students AS en
JOIN employees AS e ON en.student = e.user_id
JOIN stations AS s ON e.station = s.id
JOIN courses_instructed AS ci ON en.pid = ci.ci_id
JOIN courses as c on ci.ci_course = c.id
WHERE en.pid =$course_id
ORDER BY e.last_name";
$result = $conn->query($sql);
?>
<style>
.table-fixed thead {
width: 97%;
}
.table-fixed tbody {
height: 230px;
overflow-y: auto;
width: 100%;
}
.table-fixed thead, .table-fixed tbody, .table-fixed tr, .table-fixed td, .table-fixed th {
display: block;
}
.table-fixed tbody td, .table-fixed thead > tr> th {
float: left;
border-bottom-width: 0;
}
</style>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<h4>
Fixed Header Scrolling Table
</h4>
</div>
<table class="table table-fixed">
<thead>
<tr>
<th class="col-xs-4">Student</th><th class="col-xs-4">Station</th><th class="col-xs-4">Level</th>
</tr>
</thead>
<tbody>
<?php while($row = $result->fetch_assoc()) {
if($row['level'] == 11){
$level = 'Ambulette';
}elseif($row['level'] == 2){
$level = 'Dispatcher';
}elseif($row['level'] == 3){
$level = 'EMT';
}elseif($row['level'] == 4){
$level = 'AEMT';
}elseif($row['level'] == 5){
$level = 'Paramedic';
}elseif($row['level'] == 6){
$level = 'IT';
}elseif($row['level'] == 7){
$level = 'RN / Medic';
}
else{$level = '';}
$base_level = $row['base_level'];
$elevel = $row['level'];
if($elevel < $base_level){
$style = 'class="table-warning"';
}else{
$style = '';
}
?>
<tr>
<td class="col-xs-4"><?php echo $row['full_name'] ?></td><td class="col-xs-4"><?php echo $row['station'] ?></td><td class="col-xs-4"><?php echo $level ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>