Jump to content

mysql variable in the stylesheet ref??


newmedia

Recommended Posts

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.

Link to comment
Share on other sites

[!--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>

<?php
include("../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 : people

fields: | 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??



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.