I am trying to use a form to set colors in a table in my database, then call those colors into my stylesheet (style.php)
Defining the color variables manually works:
<?php
header("Content-type: text/css");
$color1 = '#cc0000';
?>
#thisdiv { background-color: <?php echo $color1; ?>; }
But this does not:
<?php
header("Content-type: text/css");
$getSettings = mysqli_query($db, "SELECT * FROM settings WHERE setting_id = 1");
$setting = mysqli_fetch_assoc($getSettings);
$color1 = $setting['setting_color1'];
?>
#thisdiv { background-color: <?php echo $color1; ?>; }
My 'settings' table looks like this:
setting_id | setting_color1 | setting_color2 | setting_color3
1 | #cc0000 | #000000 | #ffffff
How can I get this working properly? Maybe I am doing something wrong, or maybe I am just overlooking something stupid. Any help is appreciated.