Files
2016-10-18 05:46:32 +02:00

123 lines
3.4 KiB
PHP

<?php
$page = 4;
require("inc_header.php");
if(!isset($_GET['id']))
{
header("Location: songs.php");
}
$song_id = $_GET['id'];
// ======================================================
// GET SONG DETAILS
// ======================================================
$query = "SELECT * FROM `song` WHERE `id`=$song_id";
$result_temp = mysqli_query($connection, $query);
$result = mysqli_fetch_assoc($result_temp);
$song_title = $result['title'];
$song_author = $result['author'];
// ======================================================
// SONGINSTANCES
// ======================================================
$table = "";
$query = "SELECT `id`, `difficulty`, `enemies`, (SELECT COUNT(1) FROM `playdata` WHERE `songinstance`=songinstance.`id`) as sis
FROM `songinstance`
WHERE `song`=$song_id";
$result_temp = mysqli_query($connection, $query);
while($result = mysqli_fetch_assoc($result_temp))
{
$table .= "<tr>";
$table .= "<td><a href='" . returnurl('songinstance.php?id=' . $result['id']) . "'>" . $result['difficulty'] . "</a></td>";
$table .= "<td>" . $result['enemies'] . "</td>";
$table .= "<td>" . $result['sis'] . "</td>";
$table .= "</tr>";
}
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Song
<small><?php echo $song_title; ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="songs.php"><i class="ion ion-music-note"></i> Songs</a></li>
<li class="active"><a href="#"></i> <?php echo $song_title; ?></a></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-sm-6 col-xs-12">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3><?php echo $song_title; ?></h3>
<p>Title</p>
</div>
</div>
</div><!-- ./col -->
<div class="col-sm-6 col-xs-12">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<h3><?php echo $song_author; ?></h3>
<p>Author</p>
</div>
</div>
</div><!-- ./col -->
</div><!-- /.row -->
<div class="row">
<div class="col-lg-12">
<!-- TABLE: LATEST SONGS -->
<div class="box">
<div class="box-header with-border">
<i class="ion ion-music-note"></i>
<h3 class="box-title">Song</h3>
</div><!-- /.box-header -->
<div class="box-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Difficulty</th>
<th>Total Enemies</th>
<th># Played</th>
</tr>
</thead>
<tbody>
<?php
echo $table;
?>
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<?php
require("inc_footer.php");
?>