newmedia Posted March 11, 2006 Share Posted March 11, 2006 Can anyone tell me.. is it possible to stick a mysql variable in the stylesheet reference in the header of a document or whould it have to follow the connect to database command further down the page?call me crazy but,i wanted to change the layout of a database record depending on its row $id. Quote Link to comment https://forums.phpfreaks.com/topic/4690-mysql-variable-in-the-stylesheet-ref/ Share on other sites More sharing options...
AV1611 Posted March 11, 2006 Share Posted March 11, 2006 Sure, no problem... and if you post some code, someone might be able to show you how! Quote Link to comment https://forums.phpfreaks.com/topic/4690-mysql-variable-in-the-stylesheet-ref/#findComment-16433 Share on other sites More sharing options...
newmedia Posted March 11, 2006 Author Share Posted March 11, 2006 [!--quoteo(post=353938:date=Mar 11 2006, 10:58 AM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Mar 11 2006, 10:58 AM) [snapback]353938[/snapback][/div][div class=\'quotemain\'][!--quotec--]Sure, no problem... and if you post some code, someone might be able to show you how![/quote]ok! here's the code: <html><head> <link rel="stylesheet" type="text/css" href="../assets/<?php echo ($style) ?id=$id>"> </head> ^^^^not sure about this -------<body><?phpinclude("../assets/dbinfo.inc.php");mysql_connect(localhost,$username,$password) or die( "Error! Could not connect to database: " . mysql_error() ); $id = $_REQUEST['id']; // retrieve the row from the database $query = "SELECT * FROM `people` WHERE `id`='$id'";?>_____________and here's the database:table : peoplefields: | ID | STYLE | NAME | SURNAME | etc... -------------------------------------------records: | 1 | style1.css | John | Smith | .... ----------------------------------------- | 2 | style2.css | Tom | Jones | ......it was something like that. I'm a real novice so may need more than a forum to save me but if you had any comments on whether mysql in the header will work that would be great.. anyone?? Quote Link to comment https://forums.phpfreaks.com/topic/4690-mysql-variable-in-the-stylesheet-ref/#findComment-16445 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.