我有问题mysqli一直说mysqli_num_rows()期望参数1是mysqli_result,boolean给出

时间:2016-06-15 10:22:23

标签: php

这是代码:

<div id="spinner" class=" col-lg-13"> 
    <div class="line"></div> 
    <div class="spinner"> 
        <ul class="cont"> </ul> 
    </div> 
</div> 
<div class="col-lg-13 col border-right col-spinner"> 
    <div class="col-xs-12 col-sm-8 col-md-8 icon-col"> 
        <div class="users-online ico"> 
            <div class="img"></div> 
                <span id="users-online" class="h3">
                <?php
                      $result = mysqli_query($link, "SELECT id FROM games WHERE `starttime` > ".(time()-86400));
                      $result2 = mysqli_query($link, "SELECT id FROM users WHERE `lastseen` > ".(time()-86400));
                      echo mysqli_num_rows($result2);
                ?>
                </span> 
                <?php echo $msg[$lang]["ptd"]; ?> 
            </div> 
        </div> 
        <div class="col-xs-12 col-sm-8 col-md-8 icon-col"> 
        <div class="games-today ico"> 
            <div class="img"></div> 
                <span id="games-today" class="h3">
                <?php
                    $result2 = mysqli_query($link, "SELECT id FROM users WHERE `lastseen` > ".(time()-86400));
                    echo mysqli_num_rows($result); 
                ?>
                </span> 
                <?php echo $msg[$lang]["gtd"]; ?> 
            </div> 
        </div> 
        <div class="col-sm-8 col-md-8 icon-col hidden-xs"> 
            <div class="biggest-win ico"> 

1 个答案:

答案 0 :(得分:-1)

使用您的查询:

 $result = mysqli_query($link, "SELECT id FROM games WHERE `starttime` > '".(time()-86400))."'";
 $result2 = mysqli_query($link, "SELECT id FROM users WHERE `lastseen` > '".(time()-86400))."'";
 echo mysqli_num_rows($result2);