用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>

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."'";