请帮助我,我尝试用分页创建搜索引擎,一切似乎都很好,除非我点击回到第1页的链接,它从mysql中有序地从我输入的查询中提取数据,但这只发生在我的页面one.when我点击我需要真正帮助这个!!!
<?php
session_start();
error_reporting(E_ERROR);
$link = mysql_connect("localhost","root","1234");
mysql_query("Use igstore");
$pagesquery = mysql_query("SELECT COUNT('creatorid') FROM `creator`");
$pages = ceil(mysql_result($pagesquery, 0)/$perpage);
$page = (isset($_GET['page']))?(int)$_GET['page']:1;
$start = ($page-1)*$perpage;
//to filter from inputted data from textbox and combobox
if($value == null&&$genre == null&&$star == null){
$sql = "SELECT * FROM `creator` WHERE `title` LIKE '%$find%' OR `creatorid` LIKE '$item' LIMIT $start, $perpage";}
else if($value != null){
$sql = "SELECT * FROM `creator` WHERE `aprice` = '$value' OR `creatorid` LIKE '$item' LIMIT $start, $perpage";}
else if($genre != null){
$sql = "SELECT * FROM `creator` WHERE `type` = '$genre' OR `creatorid` LIKE '$item' LIMIT $start, $perpage";}
else if($star != null){
$sql = "SELECT * FROM `creator` WHERE `popular` = '$star' OR `creatorid` LIKE '$item' LIMIT $start, $perpage";}
$result = mysql_query($sql) or die(mysql_error());
while($_GET = mysql_fetch_array($result)){
$head = $_GET['title'];
$def = $_GET['description'];
$pric = $_GET['aprice'];
$blob = $_GET['img1'];
echo"<html>";
echo'<table height="180" width="1300">';
echo"<tr>";
echo'<th align="center">';
echo'<div class="ab">';
echo'<img src="data:image/jpeg;base64,'.base64_encode($blob).'"/ width="150px" height="150px">';
echo'</div>';
echo'</th>';
echo'<th align="left">';
echo'<div class="container">';
echo"<a href='#'><h3>$head</h3></a>";
echo"<textarea style='resize: none;border: none' rows='5' cols='60' readonly>$def</textarea><br>";
echo"<label class='control-label col-sm-2'><h5>ราคา: $pric</h5></label><br><br>";
echo"</div>";
echo'</th>';
echo"</tr>";
echo'</table>';
echo'<hr width="100%">';
echo"</html>";
}
//this is for showing page number
$prev = $page - 1;
$next = $page + 1;
echo "<a href='result.php?page=$prev' style='display: inline-block';>Prev</a>";
for($index=1;$index<=$pages;$index++){
echo ($page == $index)?'<b><a href="?page='.$index.'" style="display: inline-block"; >'.$index.'</a> </b>':'<a href="?page='.$index.'" style="display: inline-block"; >'.$index.'</a>';
}
echo "<a href='result.php?page=$next' style='display: inline-block';>Next</a>";
?>