I've done this and it works okay.
Here is the code
index.php:
<!-- start index.php-->
<head>
<?
//start browser check
if((ereg("Nav", getenv("HTTP_USER_AGENT"))) || (ereg("Gold", getenv("HTTP_USER_AGENT"))) || (ereg("X11", getenv("HTTP_USER_AGENT"))) || (ereg("Mozilla", getenv("HTTP_USER_AGENT"))) || (ereg("Netscape", getenv("HTTP_USER_AGENT"))) AND (!ereg("MSIE", getenv("HTTP_USER_AGENT")))) $browser = "ns";
elseif(ereg("MSIE", getenv("HTTP_USER_AGENT"))) $browser = "ie";
else $browser = "Other";
//end browser check
if ($browser == "ie")
{
echo ("<style>\n");
echo ("<!--\n\n");
include ("style.php");
echo ("-->\n\n");
echo ("</style>\n");
}
else
{
echo ("<link rel='stylesheet' type='text/css' href='style.php' />\n");
}
?>
<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>
<center>
<table border='0' cellpadding='0' cellspacing='0' width='700'>
<tr>
<td width='10'>HELLO</td>
</td>
</tr>
</table></td>
</tr>
</table>
</center>
</body>
<!--end index.php-->
style.php
<!--start style.php-->
<?
$style_td_fontsize = ("20px");
$style_body_background = ("#aa00aa");
?>
body { background:<? echo $style_body_background; ?>; }
A { color: #ffffff; text-decoration: none; }
A:hover { color: #ff9900; text-decoration : none; }
td { font-family: verdana,helvetica,arial; font-size: <? echo $style_td_fontsize; ?>; color: #ffffff; }
<!--end style.php-->
I do a browser check because Macs come bundled with Netscape 4.6 which doesn't like external style sheets, only inline ones so unless users upgrade, they will probably have NS 4.6.
The variable in the stylesheet do not come from a database but they could easily be substituted for values that do.
This won't be effected by your server settings or anything like that, it will be more of a client side issue. If you are follow this and it still doesn't work I would suggest that the data that's coming from the database is checked.
One thing I did notice in your code was that you didn't complete the style definition with a ";" at the end of it. I'm not sure that this will have an effect but it would be good practice to do so.
Hope this helps