dsilhx5830 2015-05-14 17:24
浏览 197
已采纳

mysqli_fetch_all()未执行,或与MYSQLI_ASSOC一起发出

I have encountered an interesting problem that I have no idea how to fix. I was creating my website on XAMPP, where it works fine. But once it was uploaded to the server, a portion of my php code is simply not being executed. I placed echo statements throughout the code to determine why my php function stopped, and this statement here seems to be the issue - $row_id = mysqli_fetch_all($r, MYSQLI_ASSOC);

There is an earlier database pull that goes like this -

$id = $_SESSION['admin_id'];
$q = "SELECT user_id FROM adminsofusers WHERE admin_id = $id";
$r = mysqli_query($dbc, $q) or trigger_error("Query: $q
<br> MySQL Error: " . mysqli_error($dbc));

I have tried running a mysqli_num_rows() on $r and it returns as 1, which it should, so I have determined that the issue lies with $row_id = mysqli_fetch_all($r, MYSQLI_ASSOC);

Everything after this statement is disregarded, and anything put in the php script after it does not matter. It is still working fine on my local server, however. Any ideas? Likely a problem with my hosting server?

  • 写回答

1条回答 默认 最新

  • dsgdhf5674 2015-05-14 17:39
    关注

    mysqli_fetch_all() needs php 5.3+ and morever requires mysqlnd installed. a

    Alternatively you can use

    $result = mysqli_query($con,$query);
    while($row = mysqli_fetch_assoc($result)) {
        $arr[] = $row;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line