Файл: Source/admin/faq.php
Строк: 84
<?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>FAQ</b> </h1>
</div>
<!-- End page header -->
<!-- Begin info box -->
<div class="row">
<div class="col-md-12">
<div class="box-info">
<h2>FAQ</h2>
<?php
include("Classes/Easy_Pagination.php");
// how many records should be displayed on a page?
$records_per_page = 10;
// instantiate the pagination object
$pagination = new Easy_Pagination();
// the MySQL statement to fetch the rows
$MySQL = 'SELECT SQL_CALC_FOUND_ROWS * FROM chesto_zadavani_vaprosi 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>Question</th>
<th>User</th>
<th>Status</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 style="width:50%;"><?php echo $info['vapros'] ?></td>
<td><?php echo $info['pital'] ?></td>
<td>
<?php
if ($info['active'] == "yes") {
?>
<span class="label label-success">Answered</span>
<?php
} elseif ($info['active'] == "no") {
?>
<span class="label label-warning">Wait for answering</span>
<?php
}
?>
</td>
<td><a href="answer_faq.php?id=<?php echo $info['id']; ?>" class="btn btn-success">Answer</a>
<a href="delete_faq.php?id=<?php echo $info['id']; ?>" class="btn btn-danger">Delete question</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
// show the pagination links
$pagination->render();
?>
</div>
<?php
footer();
?>
</div>
</div>