Доброго времени суток, уважаемый. Помогите, пожалуйста. Поставил листалку на поиск, но теперь выдаёт пустую страницу.
Код:
<?php
session_start();
include ("blocks/db.php");
if (isset($_POST['submit_s'])) {
$submit_s = $_POST['submit_s'];
}
if (isset($_POST['search'])) {
$search = $_POST['search'];
}
if (isset($submit_s)) {
if (empty($search) or strlen($search) < 4) {
exit ("<p>Вы не ввели ниодного слова в поисковую строку, либо Ваш запрос менее четырёх символов</p>");
}
$search = trim($search);
$search = stripslashes($search);
$search = htmlspecialchars($search);
}
else {
exit ("<p>Вы обратились к файлу без необходимых параметров</p>");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<link rel="icon" href="images/site/icon.ico" type="image/x-icon">
<link rel="shortcut icon" href="images/site/icon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="css/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="js/jquery 1.9.0.js" type="text/javascript"></script>
<script src="js/tooltip.js" type="text/javascript"></script>
<script src="js/sound.js" type="text/javascript"></script>
<title><?php echo "Результат поиска - $search";?></title>
</head>
<body>
<div id="wrapper">
<?php include ("blocks/header.php");?>
<?php include ("blocks/sidebar_l.php");?>
<?php include ("blocks/sidebar_r.php");?>
<div id="conteiner">
<div id="conteiner_t">
<div class="title">«<?php echo "Результат поиска - $search";?>»</div>
</div>
<div id="conteiner_c">
<?php
$result10 = mysql_query ("SELECT id, author, title, year, postscoring, description, image, view, date, meter FROM audiobooks WHERE MATCH(author, title, text) AGAINST('$search')", $db);
$count_list=floor((mysql_num_rows($result)-1)/12)+1;
if (is_numeric($_GET[page]) and $_GET[page]>0) {
if ($_GET[page]>$count_list) $page=$count_list;
else $page=$_GET[page];}
else $page=1;
if ($page==0) $page=1;
$result10 = mysql_query("SELECT id, author, title, year, postscoring, description, image, view, date, meter FROM audiobooks WHERE MATCH(author, title, text) AGAINST('$search') ORDER BY id DESC LIMIT ".($page*12-12).",12", $db);
echo "
<div id='block'>
<div id='block_t'><a class='link' title='Подробнее' href='book.php?id=$comments[id]'>«$comments[title]»</a></div>
<div id='block_c'>
<table align='center'>
<tr>
<td>
<div id='img'>
<img class='img' src='$comments[image]'>
</div>
</td>
</tr>
</table>
<div id='txt'>
<p><strong>Автор:</strong> $comments[author]</p>
<p><strong>Название:</strong> $comments[title]</p>
<p><strong>Год издания:</strong> $comments[year]</p>
<p><strong>Озвучил(а):</strong> $comments[postscoring]</p>
<p><strong>Описание:</strong> $comments[description]</p>
</div>
</div>
<div id='block_b'>
<table align='center' width='500'>
<tr>
<th>«Просмотров: $comments[view]»</th>
<th>«Добавлена: $comments[date]»</th>
<th>«Отзывов: $comments[meter]»</th>
</tr>
</table>
</div>
</div>";
}
?>
</div>
<div id="conteiner_b">
<?php
$_SESSION[full_url]=mysql_real_escape_string(basename($_SERVER['REQUEST_URI']));
$_SESSION[mess_url]=strtok($_SESSION[full_url], '?');
function col_pages($count, $this, $radius) {
$j=0; $out=""; $td='<th width="30">';
if (($this-$radius)<1) $i=1;
else $i=$this-$radius;
if ($i==1) $i++;
if (($count-($radius*2+1))<$i) $i=$count-($radius*2+1);
if ($i<2) $i=2;
if ($this!=1)
$out.=$td.'<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'&page=1">1</a></th>';
else $out.=$td.'<b><u> 1 </u></b></td>';
if ($i>2) $out.=$td.'...</th>';
while ((($i<=($this+$radius)) or ($j<($radius*2+1))) and ($i<$count)) {
if ($i!==$this)
$out.=$td.'<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'&page='.$i.'">'.$i.'</a></th>';
else $out.=$td.'<b><u> '.$i.' </u></b></th>';
$i++; $j++;
}
if ($i<$count) $out.=$td.'...</th>';
if ($count>1) {
if ($count!=$this)
$out.=$td.'<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'&page='.$count.'">
'.$count.'</a></th>';
else $out.=$td.'<b><u> '.$count.' </u></b></th>';
}
return $out;
}
echo '<table align="center">';
echo '<tr>';
echo '<th width="80">';
if ($page>1) echo '<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'">«В начало»</a>';
else echo '«В начало»';
echo '</th>';
echo '<th width="80">';
if ($page>1) echo '<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'&page='.($page-1).'">«Назад»</a>';
else echo '«Назад»';
echo '</th>';
echo col_pages((int)$count_list, (int)$page, 2);
echo '<th width="80">';
if ($page<$count_list) echo '<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'&page='.($page+1).'">«Вперёд»</a>';
else echo '«Вперёд»';
echo '</th>';
echo '<th width="80">';
if ($page<$count_list) echo '<a href="'.$_SESSION[mess_url].'?search='.$_POST['search'].'&page='.$count_list.'">«В конец»</a>';
else echo '«В конец»';
echo '</th>';
echo '</tr>';
echo '</table>';
?>
</div>
</div>
<?php include ("blocks/footer.php");?>
</div>
</body>
</html>