Debug Mode from database

Hi!
I would like to create in admin panel to switch debug mode to on/off.
I created new table ‘settings’ with one row:
Id: 1,
Name: Debug Mode,
Value: 0
And this is the moment when I am wondering how to transfer value of this row to app.php to set debug mode to on/off from admin panel.

I was trying and searching in the internet.
Greetings

Hi,
You can try that, put it in AppController or beforeFilter method in controller:

    $debug = .....//Get value in database
    Configure::write('debug', $debug);

Good luck <3