Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP分页系统不支持';当包含多个mysqli查询时,t工作_Php_Mysqli_Pagination - Fatal编程技术网

PHP分页系统不支持';当包含多个mysqli查询时,t工作

PHP分页系统不支持';当包含多个mysqli查询时,t工作,php,mysqli,pagination,Php,Mysqli,Pagination,我有一个包含多个查询的网页(PHP),用于从数据库中获取特定的表数据 我最近尝试将分页包含在其中,但似乎分页系统不起作用,即,它显示页码,但在第一页打印DB表中的所有数据,将所有其他页面留空 然后我在PHP页面中只保留了一个查询,然后它就可以正常工作了。。这是荒谬的 单个查询的PHP查询代码(此查询的分页工作): <div class="navi"> <?php //Sql starts no

我有一个包含多个查询的网页(PHP),用于从数据库中获取特定的表数据

我最近尝试将分页包含在其中,但似乎分页系统不起作用,即,它显示页码,但在第一页打印DB表中的所有数据,将所有其他页面留空

然后我在PHP页面中只保留了一个查询,然后它就可以正常工作了。。这是荒谬的

单个查询的PHP查询代码(此查询的分页工作):

<div class="navi">                                  
    <?php

    //Sql starts now

    $sql = "SELECT * FROM smf_messages where id_board = 4 LIMIT ".$pageLimit." , ".$setLimit;
    $query = mysqli_query($conn, $sql);

    while ($rec = mysqli_fetch_array($query)) {
        $member = $rec["id_member"];
        $replies = $rec["id_topic"];
    ?>
    <div class="show"><a href="http://www.myurl.com/<?php echo $rec["id_msg"];?>.htm" target="_blank"><?php echo $rec['subject'];?></a></div>
    <?php } 

    ?>

    </div>

    <?php
    // Calling the Pagination Function.

    echo displayPaginationBelow($setLimit,$page);
    ?>


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-38304687-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<div class="navi">                                  
    <?php

    $sql1 = "SELECT * FROM smf_log_digest where note_type = 'topic' ORDER BY id_msg DESC";
    $query1 = mysqli_query($conn, $sql1);

    while ($rec1 = mysqli_fetch_array($query1)) {
        $number = $rec1["id_msg"];

    // SQl starts here

    $sql = "SELECT * FROM smf_messages where id_msg = $number AND id_board = 4 LIMIT ".$pageLimit." , ".$setLimit;
    $query = mysqli_query($conn, $sql);

    while ($rec = mysqli_fetch_array($query)) {
        $member = $rec["id_member"];
        $replies = $rec["id_topic"];
    ?>
    <div class="show"><a href="http://www.myurl.com/<?php echo $rec["id_msg"];?>.htm" target="_blank"><?php echo $rec['subject'];?></a></div>
    <?php } 
    }
    ?>

    </div>

    <?php
    // Calling the Pagination Function.

    echo displayPaginationBelow($setLimit,$page);
    ?>


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-38304687-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

var _gaq=_gaq | |[];
_gaq.push([''设置帐户','UA-38304687-1']);
_gaq.push([''u trackPageview']);
(功能(){
var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;
ga.src=('https:'==document.location.protocol?'https://ssl' : 'http://www“)+”.google analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);
})();
而PHP查询代码用于多个查询(分页不适用于此查询):

<div class="navi">                                  
    <?php

    //Sql starts now

    $sql = "SELECT * FROM smf_messages where id_board = 4 LIMIT ".$pageLimit." , ".$setLimit;
    $query = mysqli_query($conn, $sql);

    while ($rec = mysqli_fetch_array($query)) {
        $member = $rec["id_member"];
        $replies = $rec["id_topic"];
    ?>
    <div class="show"><a href="http://www.myurl.com/<?php echo $rec["id_msg"];?>.htm" target="_blank"><?php echo $rec['subject'];?></a></div>
    <?php } 

    ?>

    </div>

    <?php
    // Calling the Pagination Function.

    echo displayPaginationBelow($setLimit,$page);
    ?>


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-38304687-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<div class="navi">                                  
    <?php

    $sql1 = "SELECT * FROM smf_log_digest where note_type = 'topic' ORDER BY id_msg DESC";
    $query1 = mysqli_query($conn, $sql1);

    while ($rec1 = mysqli_fetch_array($query1)) {
        $number = $rec1["id_msg"];

    // SQl starts here

    $sql = "SELECT * FROM smf_messages where id_msg = $number AND id_board = 4 LIMIT ".$pageLimit." , ".$setLimit;
    $query = mysqli_query($conn, $sql);

    while ($rec = mysqli_fetch_array($query)) {
        $member = $rec["id_member"];
        $replies = $rec["id_topic"];
    ?>
    <div class="show"><a href="http://www.myurl.com/<?php echo $rec["id_msg"];?>.htm" target="_blank"><?php echo $rec['subject'];?></a></div>
    <?php } 
    }
    ?>

    </div>

    <?php
    // Calling the Pagination Function.

    echo displayPaginationBelow($setLimit,$page);
    ?>


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-38304687-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>


你刚刚删除了张贴在这里的最后一个问题吗?你刚刚删除了张贴在这里的最后一个问题吗?