I am currently getting CSS values from my database using PHP variables. This works as a php include, however I want to generate a static .css file using the output of these variables pulled from the DB. Not sure how to go about this?
css.php
<?
$sql = $dbh->prepare("SELECT * FROM styles"); //gets background_color (#000) from DB
$sql->execute();
$result = $sql->fetch();
foreach ($result as $k => $v) {
$$k = $v; //makes background_color = $background_color = #000
}
<style type="text/css">
.content {
background-color: <?=$background_color?>;
}
?>
index.php
<? require_once "css.php"; ?>
I want a static styles.css generated using css.php to look like this:
.content { background-color: ; }