如果可能,需要一些帮助?
我正在尝试为我的代码添加分页。我遇到的问题是分页脚本在没有JOIN语句的情况下工作得非常好,当我排除分页脚本时JOIN语句有效,所以它们都工作只是不在一起。
它将两个脚本一起正确计算结果只是不显示数据。
问题是当我收到错误时如何让它们一起工作:
任何帮助都会感激不尽
ini_set('display_errors', 1);
error_reporting(~0);
$Keyword = null;
if(isset($_POST["term"])){
$Keyword = $_POST["term"];
}
if(isset($_GET["term"])){
$Keyword = $_GET["term"];
}
$sql = "SELECT * FROM table1
INNER JOIN table2 ON (table1.member_id = members.id)
WHERE MATCH (name,location) AGAINST ('%".$Keyword."%' IN NATURAL LANGUAGE MODE)";
$query = mysqli_query($conn,$sql);
$num_rows = mysqli_num_rows($query);
$per_page = 2;
$page = 1;
if(isset($_GET["Page"])) {
$page = $_GET["Page"];
}
$prev_page = $page-1;
$next_page = $page+1;
$row_start = (($per_page*$page)-$per_page);
if($num_rows<=$per_page) {
$num_pages =1;
} else if(($num_rows % $per_page)==0) {
$num_pages =($num_rows/$per_page) ;
} else {
$num_pages =($num_rows/$per_page)+1;
$num_pages = (int)$num_pages;
}
$row_end = $per_page * $page;
if($row_end > $num_rows) {
$row_end = $num_rows;
}
$sql .= "SELECT * ORDER BY ID ASC LIMIT $row_start ,$row_end ";
$query = mysqli_query($conn,$sql);
while($result=mysqli_fetch_array($query,MYSQLI_ASSOC)) {