Guys, what should we do?
还好
还好 2019-02-20 15:53:35
0
5
1137

<?php

session_start();

header("Content-type:text/html;charset=utf-8"); //Set encoding

$page=isset($_GET['page']) ?$_GET['page'] :1 ;//Receive page number

$page=!empty($page) ?$page :1 ;

$F=$_GET['F'];

// Create connection

$conn = mysqli_connect("localhost", "root", "", "mybbs");

mysqli_set_charset($conn,'utf8'); //Set the character set

$table_name="tiopic";//Get the table name setting

$perpage=5;//Number of data displayed on each page

//Maximum number of pages and total number of records

$total_sql="select count(*) from $table_name ";

$total_result =mysqli_query($conn,$total_sql);

$total_row=mysqli_fetch_row($total_result);

$total = $total_row[0]; //Get the maximum page number

$total_page = ceil($total/$perpage);//Upward integer

//Critical point

$page=$page> $total_page ? $total_page:$page;//What happens when the next page number is greater than the maximum number of pages

//Paging setting initialization

$start=($page-1)*$ perpage;

$sql="select * from tiopic order by id desc limit $start ,$perpage";

$query=mysqli_query($conn,$sql);

$sum=mysqli_num_rows($query);

?>

QQ图片20190220155224.pngQQ图片20190220155214.png

还好
还好

reply all(3)
TT

It is estimated that either the function in line 24 is not supported, or there is a problem with the parameters passed in by 24.

马先生

First run your sql statement in the database to see if there is any result, and then dump the result of $query. This is a warning, not a fatal error. $sum should be the number of rows returned. You can output it to see look

学院里的小寂寞

You have to read this error message. This error message reminds you that the mysqli_num_rows() method expects the boolean value of mysqli_result to be 1, which is on line 24 of the D:\XXX path\forums.php file

  • reply How to operate it specifically? I’m a novice and don’t really understand this.
    还好 author 2019-02-20 17:24:52
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template