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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.