PDA

View Full Version : putting something from the database into a session


harmor19
09-17-2005, 04:22 AM
This is not vbulletin related.

I am working on a script that is going fairly well but I need help on sessions.

On the databae I have a table named "style". It has css, tablewidth, cellpadding, cellspacing, alt1, alt2, and default_style.

If I were to type in "index.php?act=view&styleid=2" it will show the table layout from getting info from that database (Like vbulletin does.)

My problem is that I would like to put the "styleid" in a session.

Here's a code snippet if you need it


$getstyle = mysql_query("SELECT * FROM requestv2_style WHERE styleid='{$_GET['styleid']}'")or die(mysql_error());
$style = mysql_fetch_array($getstyle);

if (!$style['styleid'])
{
$gettable = mysql_query("SELECT * FROM requestv2_style WHERE default_style='yes'")or die(mysql_error());
$table = mysql_fetch_array($gettable);
} else {
$gettable = mysql_query("SELECT * FROM requestv2_style WHERE styleid='{$style['styleid']}'")or die(mysql_error());
$table = mysql_fetch_array($gettable);
}

What it doing is seeing if it can get a style. If not then display where I set the default style. If so then display the table layout from that styleid.