mrjameer Posted September 20, 2006 Share Posted September 20, 2006 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 db2..retrieve it from db and assigned its value to some textarea for updations3..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 Quote Link to comment https://forums.phpfreaks.com/topic/21439-css-in-db/ Share on other sites More sharing options...
Daniel0 Posted September 20, 2006 Share Posted September 20, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/21439-css-in-db/#findComment-95531 Share on other sites More sharing options...
mrjameer Posted September 20, 2006 Author Share Posted September 20, 2006 yai want to store css code in db and retrieve it and want to update css code from admin cp.i already tested htmlentities,htmlspecialchars like that.everything is displaying correctly but when updating it from admin panel it is not updated. thanks mrjameer Quote Link to comment https://forums.phpfreaks.com/topic/21439-css-in-db/#findComment-95583 Share on other sites More sharing options...
Daniel0 Posted September 20, 2006 Share Posted September 20, 2006 Could we see some source code? Quote Link to comment https://forums.phpfreaks.com/topic/21439-css-in-db/#findComment-95589 Share on other sites More sharing options...
redarrow Posted September 20, 2006 Share Posted September 20, 2006 here a good admin drop down colors to help youyou could use the dropdown menu to change all the colors if it helps ok.[code]<?phpif($_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] Quote Link to comment https://forums.phpfreaks.com/topic/21439-css-in-db/#findComment-95591 Share on other sites More sharing options...
mrjameer Posted September 20, 2006 Author Share Posted September 20, 2006 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 : 267mrjameer Quote Link to comment https://forums.phpfreaks.com/topic/21439-css-in-db/#findComment-95690 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.