0

This is my code

<?php header("Content-type: text/css; charset: UTF-8");
// Admin Color Define //
$admint = "Admin";
$admincolor = mysql_query("SELECT * FROM shout_titles WHERE title = '".$admint."'");
$gac = mysql_fetch_array($admincolor);

// Co-Admin Color Define //
$cadmint = "Co-Admin";
$cacolor = mysql_query("SELECT * FROM shout_titles WHERE title = '".$cadmint."'");
$gcac = mysql_fetch_array($cacolor);

// Moderator Color Define //
$modt = "Moderator";
$modcolor = mysql_query("SELECT * FROM shout_titles WHERE title = '".$modt."'");
$gmodc = mysql_fetch_array($modcolor);

// Banned Color Define //
$bannedt = "Banned";
$bancolor = mysql_query("SELECT * FROM shout_titles WHERE title = '".$bannedt."'");
$gbanc = mysql_fetch_array($bancolor);

// New Color Define //

?>
div#shoutbox {
    border: 1px solid #000000;
    width: 500px;
    height: 1000px;
    overflow: scroll;
    overflow-x: hidden;
    word-wrap: break-word;
    color: #000000;
    background: #FFFFFF;
    font-family: Arial, Helvetica, sans-serif;
    position: relative;
    left: 15px;
}
a{
    font-weight: bold;
}
.bgOn, .bgOff {
    padding: 2px;
}
.bgOn {
    background-color: #FFFFFF;
    color: #000000;
}
.bgOn a {
    color: #000000;
}
.bgOff {
    background-color: #EBEBEB;
    color: #000000;
}
.bgOff a {
    color: #000000;
}
.date {
    text-align: right;
    font-size: 80%;
}
.delete, a.delete {
  color: #F00;
  font-weight: bold;
}
.ban, a.ban {
  font-weight: bold;
}
.title {
    font-weight: bold;
}
.group<?=$admint?> .title {
    color: <?=$gac['color']?>;
}
.group<?=$modt?> .title {
    color: <?=$gmodc['color']?>;
}
.group<?=$cadmin?> .title {
    color: <?=$gcac['color']?>;
}
.group<?=$banned?> .title {
    color: <?=$gbanc['color']?>;
}

This is how I have the call <link rel="stylesheet" href="shoutbox.php" media="screen">

the code div#shoutbox and all of the classes starting with group are not working. Everything else works fine.

Here is the output I get.

Css Output

This is the first time I have written a style sheet with php, its not that much different so I am not sure why it's not working.

It is probably something silly that I have missed but I cannot identify it.

6
  • check if short tags are enabled on php.ini. try: "<?php echo $css?>", instead Commented Nov 17, 2012 at 20:48
  • Please show output of CSS file. Commented Nov 17, 2012 at 20:48
  • Have you tried var_dump on the variables? Like $gac $admint etc. Because if the query fails it returns false, and printing false shows nothing. Commented Nov 17, 2012 at 20:49
  • Perhaps a little off topic here, but I would strongly recommend using the mysql_real_escape_string() method to escape your input values. php.net/manual/en/function.mysql-real-escape-string.php EDIT: This is, when the variables come from user input. Commented Nov 17, 2012 at 20:51
  • 1
    Can you please show output of rendered CSS file. Commented Nov 17, 2012 at 21:03

1 Answer 1

1

Check your rendered CSS File and see if there are any issues and/or paste it here :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.