需要修复mysqli_result代码

时间:2018-07-08 03:10:20

标签: php mysqli

我是php的新手,请保持温柔。我在这个论坛中找到了关于完全相同的问题的解决方案,但有些困惑。我似乎无法弄清楚为什么会出错

  

在第10行中调用未定义的函数mysqli_result()

发生吉普车。

任何人都可以帮忙

<?php
include 'connection.php';
$per_page = 10;

$pages_query = mysqli_query($con,"SELECT COUNT('uniqueID') FROM 'business'");
$pages = mysqli_result($pages_query, 0) / $per_page;

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_page;

$query = mysqli_query($con,"SELECT 'manu' FROM 'business' LIMIT $start  $per_page");
while ($query_row = mysqli_fetch_assoc($query)) {
echo '<p>', $query_row['manu'] ,'</p>';
}
?>

2 个答案:

答案 0 :(得分:0)

尝试这样

<?php
include 'connection.php';
$per_page = 10;

$pages_query = mysqli_query($con,"SELECT COUNT('uniqueID') FROM 'business'");
$result = mysqli_fetch_row($pages_query); // <----- added
$pages = $result[0] / $per_page; // <------- modified

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_page;

$query = mysqli_query($con,"SELECT 'manu' FROM 'business' LIMIT $start  $per_page");
while ($query_row = mysqli_fetch_assoc($query)) {
echo '<p>', $query_row['manu'] ,'</p>';
}
?>

答案 1 :(得分:0)

<?php
include 'connection.php';
$per_page = 10;

$pages_query = mysqli_query($con,"SELECT COUNT('uniqueID') FROM 'business'");
$result = mysqli_fetch_row($pages_query); // <----- added
$pages = $result[0] / $per_page; // <------- modified

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_page;
$query = mysqli_query($con,"SELECT 'manu' FROM 'business' LIMIT $start  $per_page");
while ($query_row = mysqli_fetch_assoc($query)) {

echo '<p>'. $query_row['manu'] .'</p>';

}
?>