kadaen Posted August 13, 2008 Share Posted August 13, 2008 Ok I am fairly new to php and MySql, I am designing a web site for a friends guild for the game Shaiya, anyways it is a mini content management system in it where they have their own page cane leave posts and comments and members can look up item or quest information, Everything is going smooth and pretty much all up and running except I have ran into a little snag, more than likely I am just over looking something small that always seems to be the case, anyways here is what I am doing Member log into the site, they have quest, and equipment links they can click on to get an overview. Ok the member wants to check out one quests so he/she clicks the quest link, it then takes them to a page quests.php with a list of every quest the admin has implemented, the way I set it up is if they click on the name of the quest it will take them to quest_desc.php page where it shows the information on that specific quest, Now the equipment page is set up the exact same way you click the equipment.php link and takes u to a list of equipment the admin had implemented, you click the name of the item u want to get more info on and it takes you to the equip_desc.php page. So both the quest and equipment pages are set up the exact same way. Now say I am in the quest_desc.php page it has a list of all the information on that quest, name, exp, gold, and an equipment reward, now what I am trying to do is put a link from the equipment reward name that will take me to the equip_desc.php page for that item. It is pretty much the same concept from when I connected the quest name to the quest_desc.php page and same for the equipment page, this time I am trying to connect the link from the quest_desc.php page to the equip_desc.php page by clicking on the reward item listed on the quest_desc.php page. I am not sure what I am missing but I get the pages to connect but the equip_desc.php page does not populate with the item information. Thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/119422-phpmysql-page-linking/ Share on other sites More sharing options...
.josh Posted August 13, 2008 Share Posted August 13, 2008 would help if you showed some code and be more specific than "does not populate" - as in, any error messages? etc... Quote Link to comment https://forums.phpfreaks.com/topic/119422-phpmysql-page-linking/#findComment-615211 Share on other sites More sharing options...
kadaen Posted August 13, 2008 Author Share Posted August 13, 2008 no error msg or anything the fields just do not populate with the information from the database Quote Link to comment https://forums.phpfreaks.com/topic/119422-phpmysql-page-linking/#findComment-615212 Share on other sites More sharing options...
kadaen Posted August 13, 2008 Author Share Posted August 13, 2008 ok here is some code, lots of code so i will post what i can and hope its not to much lol quest_desc.php <form action="commit_desc.php?action=<?php echo $_GET['action']; ?>&type=quest&id=<?php echo $_GET['id']; ?>" method="post"> <table border="0" width="700" cellspacing="1" cellpadding="3" bgcolor="#353535" align="center"> <tr> <td bgcolor="#" width="30%">Quest Name</td> <td bgcolor="#" width="70%"><?php echo $quest_name; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Level</td> <td bgcolor="#" width="70%"><?php echo $quest_level; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Location</td> <td bgcolor="#" width="70%"><?php echo $quest_location; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Quest Giver</td> <td bgcolor="#" width="70%"><?php echo $quest_giver; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Objective</td> <td bgcolor="#" width="70%"><?php echo $quest_objective; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Experiance</td> <td bgcolor="#" width="70%"><?php echo $quest_exp; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Gold</td> <td bgcolor="#" width="70%"><?php echo $quest_gold; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Item Reward</td> <td bgcolor="#" width="70%"> <!-- This is the line of code i am having problems with --> <a href="equip_desc.php?action=q_desc&id=<?php echo $_GET['equip_id']; ?>"><?php echo $quest_reward; ?></a></td> </tr> <tr> <td bgcolor="#" width="30%">Type</td> <td bgcolor="#" width="70%"><?php echo $quest_type; ?></td> </tr> <tr> <td bgcolor="#" width="30%">Notice</td> <td bgcolor="#" width="70%"><?php echo $quest_notice; ?></td> </tr> </table> </form> the quest_desc.php page is connected to commit_desc.php which consists of <?php switch ($_GET['action']) { //==========================================Quests============================================ case "q_desc": switch ($_GET['type']) { case "quest": $sql = "UPDATE quest SET quest_name = '" . $_POST['quest_name'] . "', quest_level = '" . $_POST['quest_level'] . "', quest_location = '" . $_POST['quest_location'] . "', quest_giver = '" .$_POST['quest_giver']."', quest_objective = '" . $_POST['quest_objective'] . "', quest_exp = '" . $_POST['quest_exp'] . "', quest_gold = '" . $_POST['quest_gold'] . "', quest_reward = '" . $_POST['quest_reward'] . "', quest_type = '" . $_POST['quest_type'] . "', quest_notice = '" . $_POST['quest_notice'] . "' WHERE quest_id = '" . $_GET['id'] . "'"; break; } break; case "q_add": switch ($_GET['type']) { case "quest": $sql = "INSERT INTO quest (quest_name, quest_level, quest_location, quest_giver, quest_objective, quest_exp, quest_gold, quest_reward, quest_type, quest_notice) VALUES ('" . $_POST['quest_name'] . "', '" . $_POST['quest_level'] . "', '" . $_POST['quest_location'] . "', '" . $_POST['quest_giver'] . "', '" . $_POST['quest_objective'] . "', '" . $_POST['quest_exp'] . "', '" . $_POST['quest_gold'] . "', '" . $_POST['quest_reward'] . "', '" . $_POST['quest_type'] . "', '" . $_POST['quest_notice'] . "')"; break; } break; //==========================================Equipment============================================ case "e_desc": switch ($_GET['type']) { case "equip": $sql = "UPDATE equip SET equip_name = '" . $_POST['equip_name'] . "', equip_level = '" . $_POST['equip_level'] . "', equip_stats = '" . $_POST['equip_stats'] . "', equip_type = '" .$_POST['equip_type']."', equip_buy_from = '" . $_POST['equip_buy_from'] . "', equip_price = '" . $_POST['equip_price'] . "', equip_drop_loc = '" . $_POST['equip_drop_loc'] . "', equip_desc = '" . $_POST['equip_desc'] . "' WHERE equip_id = '" . $_GET['id'] . "'"; break; } break; case "e_add": switch ($_GET['type']) { case "equip": $sql = "INSERT INTO equip (equip_name, equip_level, equip_stats, equip_type, equip_buy_from, equip_price, equip_drop_loc, equip_desc) VALUES ('" . $_POST['equip_name'] . "', '" . $_POST['equip_level'] . "', '" . $_POST['equip_stats'] . "', '" . $_POST['equip_type'] . "', '" . $_POST['equip_buy_from'] . "', '" . $_POST['equip_price'] . "', '" . $_POST['equip_drop_loc'] . "', '" . $_POST['equip_desc'] . "')"; break; } break; } if (isset($sql) && !empty($sql)) { echo "<!--" . $sql . "-->"; $result = mysql_query($sql) or die("Invalid query: " . mysql_error()); ?> <p align="center" style="color:#FF0000"> Done. <a href="admin_db.php">Admin Home Page</a> </p> <?php } ?> quest_desc.php is also connected to desc.php page which consists of <?php switch ($_GET['action']) { case "q_desc": $questsql = "SELECT * FROM quest WHERE quest_id = '" . $_GET['id'] . "'"; $result = mysql_query($questsql) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_array($result); $quest_name = $row['quest_name']; $quest_level = $row['quest_level']; $quest_location = $row['quest_location']; $quest_giver = $row['quest_giver']; $quest_objective = $row['quest_objective']; $quest_exp = $row['quest_exp']; $quest_gold = $row['quest_gold']; $quest_reward = $row['quest_reward']; $quest_type = $row['quest_type']; $quest_notice = $row['quest_notice']; break; case "e_desc": $equipsql = "SELECT * FROM equip WHERE equip_id = '" . $_GET['id'] . "'"; $result = mysql_query($equipsql) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_array($result); $equip_name = $row['equip_name']; $equip_level = $row['equip_level']; $equip_stats = $row['equip_stats']; $equip_type = $row['equip_type']; $equip_buy_from = $row['equip_buy_from']; $equip_price = $row['equip_price']; $equip_drop_loc = $row['equip_drop_loc']; $equip_desc = $row['equip_desc']; break; default: $quest_name = ""; $quest_level = ""; $quest_location = ""; $quest_giver = ""; $quest_objective = ""; $quest_exp = ""; $quest_gold = ""; $quest_reward = ""; $quest_type = ""; $quest_notice = ""; $equip_name = ""; $equip_level = ""; $equip_stats = ""; $equip_type = ""; $equip_buy_from = ""; $equip_price = ""; $equip_drop_loc = ""; $equip_desc = ""; break; } ?> both equip_desc.php and quest_desc.php connects to commit_desc.php, desc.php Quote Link to comment https://forums.phpfreaks.com/topic/119422-phpmysql-page-linking/#findComment-615226 Share on other sites More sharing options...
kadaen Posted August 13, 2008 Author Share Posted August 13, 2008 ok i have it working to some extent, i have 2 quests and 2 items in the database, if i click test quest 1 it will take me to the quest_desc.php page where it will show info on the quest and there will be the link to the test item 1 now when i click the link to the test item 1 it then takes me to the equip_desc.php page where it will show information on the test item 1. but now if i do the exact same thing for test quest 2 everything work except for when i click the test item 2 link, when i click that link it takes me to the equip_desc.php page but it shows the information for the test item 1 here is the section of code i have been messing with trying to figure this out <tr> <td bgcolor="#" width="30%">Item Reward</td> <td bgcolor="#" width="70%"> <?php $eqsql = "SELECT * FROM quest, equip"; $result = mysql_query($eqsql) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_array($result); ?> <a href="equip_desc.php?action=e_desc&id=<?php echo $row['equip_id']; ?>"><?php echo $quest_reward; ?></a></td> if there is another section of code u might need to look at let me know... connected to the quest_desc.php and the equip_desc.php pages are listed in this thread. thank you for your time Quote Link to comment https://forums.phpfreaks.com/topic/119422-phpmysql-page-linking/#findComment-615713 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.