Mini Shell
<?php
require_once("../config.php");
require_once("function-file.php");
require_once("function-menu.php");
cookiecheck();
$sample_id=$_GET['sample_id'];
$db=$conn->prepare("select * from samples a inner join courses b on a.course_id=b.course_id where a.sample_id='$sample_id'");
$db->execute();$dbres=$db->fetch();
$dbs=$conn->prepare("select count(rat_id) as rat_id,sum(rating) as rating from rating where sample_id='$sample_id'");
$dbs->execute();$rowdd=$dbs->fetch();
$tot_rating=$rowdd['rating'];
$tot_user=$rowdd['rat_id'];
if($tot_user==0){$avg=0;}else{$avg=$tot_rating/$tot_user;}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Add Sample</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();?>
<style>iframe{width: 100% !Important;}</style>
</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 -->
<section class="content">
<!-- Default box -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Add Sample</h3>
<div class="box-tools pull-right">
<a href="rating.php" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>
</div>
</div>
<div class="box-body">
<form action="#" method="post" role="form" class="form-horizontal" enctype="multipart/form-data">
<div class="form-group">
<div class="col-sm-6"><label>Title of Sample: </label> <?php echo $dbres['title'];?></div>
<div class="col-sm-6"><label>Course Name: </label><?php echo $dbres['course_name'];?></div>
</div>
<div class="form-group">
<div class="col-sm-12"><label>Sample Description: </label><?php echo $dbres['sample_desc'];?></div>
</div>
<div class="form-group">
<div class="col-sm-12">
<?php echo $dbres['video_url'];?>
</div>
</div>
<h4>Rating</h4>
<div class="form-group">
<div class="col-sm-2">
Total Users: <?php echo $tot_user;?>
</div>
<div class="col-sm-2">
Rating: <?php echo $tot_rating;?>
</div>
<div class="col-sm-2">
Rating Average: <?php echo $avg;?>
</div>
</div>
</div><!-- /.box-body -->
</div><!-- /.box -->
</section><!-- /.content -->
</div></div><!-- /.content-wrapper -->
<?php footer();?>
</div><!-- ./wrapper -->
<?php jsfile();ratenum();?>
</body>
</html>
Zerion Mini Shell 1.0