Change CSS permanently within website


I have a database table wich includes the specific data. I want to display the settings on my website so that I can change it within the website, but it does not work. What should I do to achieve the same goal?

header("content-type: text/css");
$query = mysql_query("select * from layout where id=2", $connection);
$header_color = $_GET['header_color'];
$body_color = $_GET['body_color'];
$title_location = $_GET['title_location'];
$header_height = $_GET['header_height'];
<style type=text/css>

body {
    width: auto; height: 100%;
    margin: 0 auto; padding: 0; border: 0;
     font-family: Verdana, Arial, Helvetica, sans-serif;
     font-size: 13px; line-height: 15px;
     background: <?=$body_color?>;
#header {
    height: <?=$header_height?>;
    width: 1000px;
    margin: 0 auto; padding: 0; text-align: <?=$title_location?>;
     background: <?=$header_color?>; color: #D4E6F4;

If I understand correctly, you do not want to change the data in the database. You just want to change the data as it appears in your web site code.

Depending on the magnitude of the changes that you have in mind, you should be able to do that with a local stylesheet.

Not much info to go on, though.

What happens if the specific `$_GET’ is not isset(…)?

Try error_reporting(-1); and ini_set(‘display_errors’, ‘true’); to see what is happening.

As a side note with regard to your PHP, you need to be aware that the mysql_* extension that you’ve used was removed from version 7 of PHP. You should now be using either the mysqli_* extension (note the “i” in there) or PDO

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.