Jump to content

[SOLVED] Auto generated menu and content problem


Marfisa

Recommended Posts

Hi,

 

I'm trying to generate both a menu and page contents from a database, but can't figure out how to generate the page content. Maybe I'm just going about it the wrong way completely.

 

Here are the relevant parts of the code. (Hence all the jumping in and out of php.)

 

<?php if(!$_SERVER['QUERY_STRING']) { ?>

<?
$i=0;
while ($i < $num) {
$deck_name=mysql_result($result,$i,"deck_name");
$deck_type=mysql_result($result,$i,"deck_type");
$deck_cat=mysql_result($result,$i,"deck_cat");
$deck_desc=mysql_result($result,$i,"deck_desc");
$id=mysql_result($result,$i,"id");

if ($deck_cat=="moon") { ?>
<tr>
<td class="sub"><? echo "$deck_desc"; ?></td>
<td class="subc"><a class="table" href="index.php?<? echo "$deck_name"; ?>"><? echo "$deck_name"; ?></a></td>
<td class="subc"><? if ($deck_type=="0") {echo "20";} else {echo "10";} ?></td>
</tr>
<?
}
++$i;
}
?>

<? } if($_SERVER['QUERY_STRING'] == "deck_name_here") { ?>

<h1>Content here based on deck_name_here</h1>

etc. page content here.

 

The part I can't figure out is $_SERVER['QUERY_STRING'] == "deck_name_here" where "deck_name_here" should be a variable. It's the $deck_name in the menu that's generated by the database.

 

Or are there better ways to handle this?

 

Thanks in advance for any help. I'd really appreciate it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.