Jump to content

[SOLVED] using php variables in css ? is it possiple


fireice87

Recommended Posts

Hey iv got a script that can add colour codes to a data base and a script that pulls them out again

 

This code works fine it collects the data from the table and puts it into variables

$conn = @mysql_connect( "localhost", "user", "pass")
or die ("could not connect to mysql");  #Connect to mysql
$rs = @mysql_select_db( "db", $conn )
or die ("Could not select database"); #select database 
$sql = "Select `Backgroundcolour`,`Backgroundimage`,`Bordercolour`,`Borderthickness`,`Headingtextcolour`,`Headingtextsize`,`Maintextcolour`,`Maintextsize` FROM style_$user where id=1";

    $result= @mysql_query($sql, $conn )
or die(" Could not add style facts");

while($row = mysql_fetch_row($result))
{
    $Backgroundcolour  = $row[0];
    $Backgroundimage = $row[1];
    $Bordercolour = $row[2];
$Borderthickness = $row[3];
$Headingtextcolour = $row[4];
$Headingtextsize = $row[5];
$Maintextcolour = $row[6];
$Maintextsize = $row[7];
}

 

But this bit of code doesnt work  (in css)

#Profile {
height: 700px;
width: 920px;
background-color: <?php $Backgroundcolour ?> ;
}

 

what happens is the page display correctly(no errors) but with out any attention to the colours the variables are holding

is there a way to do what im trying or am i on the wrong tracks with this?

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.