我尝试使用this代码来解决我的项目错误
Warning: mysqli_query(): Couldn't fetch mysqli in /Applications/XAMPP/xamppfiles/htdocs/sims/searchuser.php on line 178
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /Applications/XAMPP/xamppfiles/htdocs/sims/searchuser.php on line 181
Notice:Undefined variable: total_pages’ in /Applications/XAMPP/xamppfiles/htdocs/sims/searchuser.php on line 194
<?php
//Now select all from table
$query = "SELECT `user_id`, `name`, `username`, `password`, `phone`, `email`* FROM `user_table`";
$result = mysqli_query($con, $query);
// Count the total records
$total_records = mysqli_num_rows($result);
//Using ceil function to divide the total records on per page
$total_pages = ceil($total_records / $per_page);
//Going to first page
echo "<center><a href=’searchuser.php?page=1′>”.’First Page’.”</a> ";
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href=’searchuser.php?page=”.$i.”‘>”.$i.”</a> ";
};
// Going to last page
echo "<a href=’searchuser.php?page=$total_pages’>”.’Last Page’.”</a></center> ";
?>
第194行/Applications/XAMPP/xamppfiles/htdocs/sims/searchuser.php中未定义的变量:total_pages
这是我的编码