Jump to content

css in db


mrjameer

Recommended Posts

hi,

i want to store css template which has header,left navbar,center,right navbar,footer in mysql db.iam using like this

1..i will store a css template in db

2..retrieve it from db and assigned its value to some textarea for updations

3..update content

$header='<style type ="text/css">
#header{
background-color:white;
color:#009900;
border-style:solid;
border-width:3px;
height:200px;
width:300px;
padding:5px;}</style><div id="header">WELCOME</div>';
if i use this type everything is displayed correctly but when updating it iam getting error
is it the correct way to store in db or i have to use

$header='<link rel="stylesheet" type="text/css" href="abc.css"> <div id="header">WELCOME</div>';




mrjameer
Link to comment
Share on other sites

Is this what you are trying to do?

stylesheet.php: [code]<?php
$conn = mysql_connect("localhost","username","password");
mysql_select_db("some_db");

$query = mysql_query("SELECT * FROM skins WHERE id=1 LIMIT 1");

if(mysql_num_rows($query) > 0)
{
$skin_data = mysql_fetch_assoc($query);
header("Content-type: text/css");
echo $skin_data['css'];
}
?>[/code]

HTML code: [code]<link rel="stylesheet" type="text/css" href="stylesheet.php" />[/code]
Link to comment
Share on other sites

here a good admin drop down colors to help you

you could use the dropdown menu to change all the colors if it helps ok.

[code]
<?php


if($_POST['submit']){

echo $back_ground;
}

?>
<table align="center" border="4" bordercolor="black">
<td align="center">

<form method="POST" action="">
<select name="back_ground">

<option value="">Highlight</option>
<option value="#000000" style="background-color: Black;color: #FFFFFF;">Black</option>
<option value="#808080" style="background-color: Gray;">Gray</option>
<option value="#A9A9A9" style="background-color: DarkGray;">DarkGray</option>
<option value="#D3D3D3" style="background-color: LightGrey;">LightGray</option>
<option value="#FFFFFF" style="background-color: White;">White</option>
<option value="#7FFFD4" style="background-color: Aquamarine;">Aquamarine</option>
<option value="#0000FF" style="background-color: Blue;">Blue</option>
<option value="#000080" style="background-color: Navy;color: #FFFFFF;">Navy</option>
<option value="#800080" style="background-color: Purple;color: #FFFFFF;">Purple</option>
<option value="#FF1493" style="background-color: DeepPink;">DeepPink</option>
<option value="#EE82EE" style="background-color: Violet;">Violet</option>
<option value="#FFC0CB" style="background-color: Pink;">Pink</option>
<option value="#006400" style="background-color: DarkGreen;color: #FFFFFF;">DarkGreen</option>
<option value="#008000" style="background-color: Green;color: #FFFFFF;">Green</option>
<option value="#9ACD32" style="background-color: YellowGreen;">YellowGreen</option>
<option value="#FFFF00" style="background-color: Yellow;">Yellow</option>
<option value="#FFA500" style="background-color: Orange;">Orange</option>
<option value="#FF0000" style="background-color: Red;">Red</option>
<option value="#A52A2A" style="background-color: Brown;">Brown</option>
<option value="#DEB887" style="background-color: BurlyWood;">BurlyWood</option>
<option value="#F5F5DC" style="background-color: Beige;">Beige</option>
</select>
<br><br>
<input type="submit" name="submit" value="choose a colour">
</select>
</form>
</td>
</table>
[/code]
Link to comment
Share on other sites

iam getting this error.iam using php4,mysql4,apache 1.3 ,windows platform[xp]
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'right='#right {position : relative; height : 779px; width : 267

mrjameer
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.