doudiyu1639 2017-03-21 06:59
浏览 17
已采纳

用PHP关闭功能

I am actually still learning PHP. I don't know what's really happening but I can't figure out a problem. Maybe it's because of PHP update or anything.

I actually made a simple PHP debugger and with print_r(); and thought I will connect it with the database so that I can turn off the switch or the actual debug code whenever I want to. I don't know the reason but it's not working. I'm providing everything that can figure out the problem if I missed anything please let me know. Here's the actual code from different page I putted it together actually.

//site Setup: (this is on the database connection file)
$debug = data_setting_value($dbc, 'debug-status');

//This one is from the function file
function data_setting_value($dbc, $id) {
    
        $q = "SELECT * FROM settings WHERE id = 'debug-id'";
        $r = mysqli_query($dbc, $q);

        $data = mysqli_fetch_assoc($r);

        return $data['value'];
}

// this one is from the index file

    <?php if ($debug == 1) { ?>
        <button id="btn-debug" class="btn btn-default"><i class="fa fa-bug"></i></button>
    <?php } ?>
}

Database file

</div>
  • 写回答

1条回答 默认 最新

  • doushijia5684 2017-03-21 07:03
    关注

    int the line $q = "SELECT * FROM settings WHERE id = 'debug-id'"; you use 'debug-id' change it to $id.

    $q = "SELECT * FROM settings WHERE id = '".$id."'";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 找人不需要人工智能回答的gamit解算后做形变分析
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 统计大规模图中的完全子图问题
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错