Файл: Source/admin/prizes.php
Строк: 77
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
include "common.php";
head();
?>
<div class="body content rows scroll-y">
<!-- Page header -->
<div class="page-heading">
<h1><b>Prizes</b> </h1>
</div>
<!-- End page header -->
<!-- Begin info box -->
<div class="row">
<div class="col-md-12">
<div class="box-info">
<h2>Prizes</h2>
<a href="add_prize.php" class="btn btn-success"><i class="fa fa-plus"></i> Add prize</a>
<hr />
<?php
include("Classes/Easy_Pagination.php");
// how many records should be displayed on a page?
$records_per_page = 7;
// instantiate the pagination object
$pagination = new Easy_Pagination();
// the MySQL statement to fetch the rows
$MySQL = 'SELECT SQL_CALC_FOUND_ROWS * FROM vn_prizes LIMIT
' . (($pagination->get_page() - 1) * $records_per_page) . ', ' . $records_per_page . '
';
// if query could not be executed
if (!($result = @mysql_query($MySQL))) {
// stop execution and display error message
die(mysql_error());
}
// fetch the total number of records in the table
$rows = mysql_fetch_assoc(mysql_query('SELECT FOUND_ROWS() AS rows'));
// pass the total number of records to the pagination class
$pagination->records($rows['rows']);
// records per page
$pagination->records_per_page($records_per_page);
$page = $pagination->get_page();
?>
<!-- Table -->
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Image</th>
<th>Title</th>
<th>Points</th>
<th>Quantity</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$index = 1;
$begin = ($page * $records_per_page) - $records_per_page;
for ($i = 0; $i < mysql_num_rows($result); ++$i) {
$info = mysql_fetch_array($result);
$rank = $i + 1 + $begin;
?>
<tr <?php echo $index++ % 2 ? ' class="active"' : '' ?>>
<td><?php echo $info['id'] ?></td>
<td><img src="<?php echo $info['image'] ?>" width="70px" /></td>
<td><?php echo $info['title'] ?></td>
<td><?php echo $info['points'] ?></td>
<td><?php echo $info['quantity'] ?></td>
<td><a href="delete_prize.php?id=<?php echo $info['id']; ?>" class="btn btn-danger">Delete prize</a>
<a href="edit_prize.php?id=<?php echo $info['id']; ?>" class="btn btn-info">Edit prize</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
// show the pagination links
$pagination->render();
?>
</div>
<?php
footer();
?>
</div>
</div>