Marfisa Posted June 14, 2008 Share Posted June 14, 2008 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. Quote Link to comment Share on other sites More sharing options...
Marfisa Posted June 15, 2008 Author Share Posted June 15, 2008 Oops, it must have been the heat earlier. $_SERVER['QUERY_STRING'] is the variable I was looking for! Never mind, topic solved. Quote Link to comment 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.