stfc_boy
02-19-2008, 08:42 AM
Hi Guys,
In the website i'm building I want to change the colour of the background of my site on a regular basis. So I want to change a value in a table in MYSQL and then this colour I enter ie: #0066CC is picked up on my site.
Now, i've tested this with an internal stylesheet on a php page and it works great, but is this possible with an external stylesheet ie something like:
php
<?php
include('php_files/*********.php');
?>
<?php
$SQL = "SELECT body_colour FROM style_test WHERE style_id = 1";
$result = mysql_query($SQL) OR die(mysql_error());
$row = mysql_fetch_array($result);
$xx = $row['body_colour'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="test.css" type="text/css" />
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
stylesheet
body {
background: <?php echo $xx; ?>;
}
However that does not seem to work.
Also can you query inside an external stylesheet (i'm, guessing not as it's not got a .php extension), ie something like:
<?php
include('php_files/*********.php');
?>
<?php
$SQL = "SELECT body_colour FROM style_test WHERE style_id = 1";
$result = mysql_query($SQL) OR die(mysql_error());
$row = mysql_fetch_array($result);
$xx = $row['body_colour'];
?>
body {
background: <?php echo $xx; ?>;
}
Thanks
Chris
In the website i'm building I want to change the colour of the background of my site on a regular basis. So I want to change a value in a table in MYSQL and then this colour I enter ie: #0066CC is picked up on my site.
Now, i've tested this with an internal stylesheet on a php page and it works great, but is this possible with an external stylesheet ie something like:
php
<?php
include('php_files/*********.php');
?>
<?php
$SQL = "SELECT body_colour FROM style_test WHERE style_id = 1";
$result = mysql_query($SQL) OR die(mysql_error());
$row = mysql_fetch_array($result);
$xx = $row['body_colour'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="test.css" type="text/css" />
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
stylesheet
body {
background: <?php echo $xx; ?>;
}
However that does not seem to work.
Also can you query inside an external stylesheet (i'm, guessing not as it's not got a .php extension), ie something like:
<?php
include('php_files/*********.php');
?>
<?php
$SQL = "SELECT body_colour FROM style_test WHERE style_id = 1";
$result = mysql_query($SQL) OR die(mysql_error());
$row = mysql_fetch_array($result);
$xx = $row['body_colour'];
?>
body {
background: <?php echo $xx; ?>;
}
Thanks
Chris