Mini Shell
<?php
require_once("../config.php");
require_once("function-file.php");
require_once("function-menu.php");
cookiecheck();
if((!empty($_GET['action']))&&($_GET['action']=='delete')){
$rat_id=$_GET['rat_id'];
$conn->exec("delete from rating where rat_id='$rat_id'");
header("location:rating.php");
}?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Rating</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<?php cssfile();datatablecss();?>
</head>
<body class="hold-transition skin-blue layout-top-nav">
<!-- Site wrapper -->
<div class="wrapper">
<?php headermenu();?>
<!-- =============================================== -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<div class="col-sm-12">
<section class="content">
<!-- Default box -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Rating</h3>
</div>
<div class="box-body">
<table class="table table-bordered table-striped dataTable" id="data-table">
<thead><tr><th>Sample Name</th><th>Course Name</th><th>Rating</th><th>Action</th></tr></thead>
<tbody>
<?php $data=$conn->prepare("select * from rating a inner join samples b on a.sample_id=b.sample_id left join courses c on b.course_id=c.course_id");
$data->execute();$result=$data->fetchall();$i=1;
foreach($result as $row){
echo "<tr>";
echo "<td>$row[title]</td>";
echo "<td>$row[course_name]</td>";
echo "<td>$row[rating]</td>";
echo "<td><a href='sample-view.php?sample_id=$row[sample_id]' title='View Sample' class='btn btn-warning btn-xs'>View</a> ";?><a href='rating.php?action=delete&rat_id=<?php echo $row['rat_id'];?>' onclick="return confirm('Are you sure you want to delete?')" title='Delete News' class='btn btn-danger btn-xs'>Delete</a></td><?php
echo "</tr>";
$i++;
}
?>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</section><!-- /.content -->
</div>
</div></div><!-- /.content-wrapper -->
<?php footer();?>
</div><!-- ./wrapper -->
<?php jsfile();datatablejs();?>
<script>
$('#data-table').dataTable({
responsive: true,
"ordering": false,
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "../apptheme/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "copy",
"mColumns": [0, 1]
},
{
"sExtends": "xls",
"mColumns": [0, 1]
},
{
"sExtends": "pdf",
"mColumns": [0, 1]
},
]
}
});
</script>
</body>
</html>
Zerion Mini Shell 1.0