|
<code> <?php $conn = mysql_connect("localhost","varun","iceman"); mysql_select_db("gamesframework",$conn);
$sql = "SELECT * FROM category"; $display_block="<ul>"; $result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) { $name= $newArray['name']; $id= $newArray['id']; $display_block .= " <li><a href=\"viewgameslist.php?id=$id\"> <strong>$name</strong></a><br> "; } $display_block .="</ul>";
if ($_GET[id]>0) { $sql1 = "SELECT * FROM category_game where category_id = $_GET[id]"; $display_block1="<ul>"; $result1 = mysql_query($sql1, $conn) or die(mysql_error());
while ($newArray1 = mysql_fetch_array($result1)) { $game_id1= $newArray1['game_id'];
$sql2 = "SELECT name,id FROM game where id = '$game_id1'"; $result2 = mysql_query($sql2, $conn) or die(mysql_error()); while ($newArray2 = mysql_fetch_array($result2)) { $game_name= $newArray2['name']; $id=$newArray2['id'];
$display_block1 .= " <li><a href=\"viewgamedetails.php?id=$id\"> <strong>$game_name</strong></a><br> "; } } $display_block1 .="</ul>"; } ?>
<html> <head> <title>Update Game</title> </head> <body> <spacer type=horizontal size=300> <a href="index.php"> <strong>Home</strong></a><br> <h1>Choose Game Category</h1> <p><?php echo $display_block ?></p> <p><?php echo $display_block1 ?></p>
</body> </html> </code>
hope this helps.... i reload the same page and pass value 2 it usin GET. when there is a user click its corresponding value is passed.. and $display_block1 is generated an displayed... if u dnt understand completely ... do ask!
|