Xyphon Posted December 16, 2007 Share Posted December 16, 2007 Here is my top <?php include('Connect.php'); /* If logged out */ if (!isset($_COOKIE['UserID'])) { echo " <html> <title> Pokemon Trainer's Challenge RPG </title> <head> <style type='text/css'> A:link { color: #AFAFAF; text-decoration: underline; } A:visited { color: #AFAFAF; text-decoration: underline; } A:hover { color: #D0D0D0; text-decoration: none; } body { background-color: #000000; background-image: url('Url here if you have a background image'); scrollbar-face-color: #000000; scrollbar-highlight-color: #000000; scrollbar-shadow-color: #000000; scrollbar-darkshadow-color: #545454; scrollbar-3d-lightcolor: #545454; scrollbar-arrow-color: #ffffff; scrollbar-track-color: #545454; } .tables { border: 1px solid #252525; background-color: #313131;} .menus { width: 130px; border: 0px solid #575757; background-color: #313131;} .content { border: 0px solid #707070; background-color: #4F4F4F;} .disclaimer { border: 1px solid #252525; background-color: #313131;} </style> </head> <body> <div align='center'> <!--BANNER--> <table class='tables' cellpadding='0' cellspacing='0' width='750' height='180'> <tr><td> <center> <font face='verdana' color='#FFFFFF' size='6'><a href='index.php'> <img border='0' src='http://i3.tinypic.com/7xaet08.jpg'> </font> </tr></td> </table> <!--END of BANNER--> <!--LEFT MENU--> <table class='tables' cellpadding='4' cellspacing='0' width='750' height='250'> <tr><td class='menus' valign='top'> <font color='#AFAFAF' face='verdana' size='1'> <CENTER> <b>Main</b><br> <a href='index.php'>Home</a><br> <a href='register.php'>Register</a><br> <a href='login.php'>Log in</a><br> </CENTER> </td> <!--END of LEFT MENU--> <!--CONTENT--> <td class='content' valign='top'> <font color='#AFAFAF' face='verdana' size='1'> <div align='justify'> <br> "; } if (isset($_COOKIE['UserID'])) { echo " <html> <title> Pokemon Trainer's Challenge RPG </title> <head> <style type='text/css'> A:link { color: #AFAFAF; text-decoration: underline; } A:visited { color: #AFAFAF; text-decoration: underline; } A:hover { color: #D0D0D0; text-decoration: none; } body { background-color: #000000; background-image: url('Url here if you have a background image'); scrollbar-face-color: #000000; scrollbar-highlight-color: #000000; scrollbar-shadow-color: #000000; scrollbar-darkshadow-color: #545454; scrollbar-3d-lightcolor: #545454; scrollbar-arrow-color: #ffffff; scrollbar-track-color: #545454; } .tables { border: 1px solid #252525; background-color: #313131;} .menus { width: 130px; border: 0px solid #575757; background-color: #313131;} .content { border: 0px solid #707070; background-color: #4F4F4F;} .disclaimer { border: 1px solid #252525; background-color: #313131;} </style> </head> <body> <div align='center'> <!--BANNER--> <table class='tables' cellpadding='0' cellspacing='0' width='750' height=<tr><td>'180'> <center> <font face='verdana' color='#FFFFFF' size='6'><a href='index.php'> <img border='0' src='http://i3.tinypic.com/7xaet08.jpg'> </font> </tr></td> </table> <!--END of BANNER--> <!--LEFT MENU--> <table class='tables' cellpadding='4' cellspacing='0' width='750' height='250'> <tr><td class='menus' valign='top'> <font color='#AFAFAF' face='verdana' size='1'> <CENTER> <b>Main</b><br> <a href='index.php'>Home</a><br> <a href='logout.php'>Logout</a><br> <a href=''>Link Here</a><br><br> <b>Catergory</b><br> <a href=''>Link Here</a><br> <a href=''>Link Here</a><br> <a href=''>Link Here</a><br> <a href=''>Link Here</a><br><br> <b>Catergory</b><br> <a href=''>Link Here</a><br> <a href=''>Link Here</a><br> <a href=''>Link Here</a><br> <a href=''>Link Here</a><br> </CENTER> </td> <!--END of LEFT MENU--> <!--CONTENT--> <td class='content' valign='top'> <font color='#AFAFAF' face='verdana' size='1'> <div align='justify'> <br> "; } $ID= $_COOKIE['UserID']; $BannedResult= mysql_query("SELECT * FROM users WHERE id='$ID'"); $BannedRows= mysql_fetch_array($BannedResult); if($BannedRows['Banned']=='Yes') { echo "Sorry, you are banned. You will now be logged out, please go <a href='index.php'>back</a>."; $usercheck = addslashes($_POST['username']); $passcheck = md5(addslashes($_POST['password'])); $Result1 = mysql_query("SELECT * FROM users WHERE username='$usercheck' AND password='$passcheck'"); $Rows1 = mysql_fetch_array($Result1); $UserID = $Rows1['ID']; setcookie("UserID", "$UserID", time() - 9999999); include("bottom.php"); exit; } ?> Here is my view party <?php include('Connect.php'); include('top.php'); $userID = $_COOKIE['UserID']; $result = mysql_query("SELECT * FROM pokemon_info"); if($row = mysql_fetch_array($result)) { echo "<table border='1' bgcolor='lightgrey'>"; echo "<th>UserID " . $row['user_id'] . "</th>"; echo "<br /><br />"; echo "<tr>"; echo "<td><center>" . $row['pokemon_name'] . "<br /><img border='0' src='" . $row['pokemon_image'] . "'></center></tr></td>"; echo "<tr><td>Attack: " . $row['pokemon_attack'] . "</tr></td>"; echo "<tr><td>Defence: " . $row['pokemon_defence'] . "</tr></td>"; echo "<tr><td>Level: " . $row['pokemon_level'] . "</tr></td>"; echo "<tr><td>EXP: " . $row['pokemon_exp'] . "</tr></td>"; echo "<tr><td><b>Moves:</b> <br /> " . $row['attack1'] . "<br />" . $row['attack2'] . "<br />" . $row['attack3'] . "<br />" . $row['attack4'] . "<br /></tr></td></table>"; } include('bottom.php'); ?> How do I make a link in the top to viewparty.php?id=1 or W/E their ID is, then in view party make it say the page according to their ID? Can someone edit those into the way I want it and tell me what they did for future reference? Or can you tell me what and where to put it? Thank you. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 16, 2007 Share Posted December 16, 2007 You already have this $userID = $_COOKIE['UserID']; Can't you just use i? Quote Link to comment Share on other sites More sharing options...
trq Posted December 16, 2007 Share Posted December 16, 2007 I'm not wading through all that code. A simple example. list.php <a href="view.php?id=1">view 1</a> <a href="view.php?id=2">view 2</a> <a href="view.php?id=3">view 3</a> view.php <?php if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT * FROM users WHERE id = '$id';"; echo $sql; } ?> You should be able to work it out from there. Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 I dont get what you are saying.. I dont understand the whole process... I go to w3schools, they dont tell me how to link a get, and they dont tell me how to get User_id.. Its really confusing, and I dont know what to do on the viewparty.... thrope: Im not making a link for every member, thats just stupid, what about when I ahve 1K mems? That makes no sence.. And what to I put in the $_get[id] Do I put the Cookie name? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 16, 2007 Share Posted December 16, 2007 You don't need to GET the ID, you already have it in a Cookie variable. Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 I have no clue what you guys are saying! 1. How do I link it 2. What do you mean when you say $_GET['id']? Im really confused. Quote Link to comment Share on other sites More sharing options...
trq Posted December 16, 2007 Share Posted December 16, 2007 Sounds like you need a lesson in the basics. Theres a good book in my sig, read it. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 16, 2007 Share Posted December 16, 2007 I have no clue what you guys are saying! 1. How do I link it 2. What do you mean when you say $_GET['id']? Im really confused. When you have a url like "Http://www.coolPokemons.com/?pokemon_id=1" You use a $_GET, to get the value of "pokemon_id", which is 1. $_GET['pokemon_id']; Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 I have no clue what you guys are saying! 1. How do I link it 2. What do you mean when you say $_GET['id']? Im really confused. When you have a url like "Http://www.coolPokemons.com/?pokemon_id=1" You use a $_GET, to get the value of "pokemon_id", which is 1. $_GET['pokemon_id']; I used $_REQUEST for the URL name and it works, but I dont know how to display things according to the URL name. Quote Link to comment Share on other sites More sharing options...
trq Posted December 16, 2007 Share Posted December 16, 2007 As my example shows, you pass the id to your sql query. All you need do then is execute said query to get the information you want from the db. Quote Link to comment Share on other sites More sharing options...
peranha Posted December 16, 2007 Share Posted December 16, 2007 $id = $_GET['pokemon_id'] SELECT * FROM table WHERE pokemon_id = $id. This is an example, Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 So why does <a href="viewparty?userID=<?php echo $_REQUEST['UserID']; ?>">Link text</a> <?php include('Connect.php'); include('top.php'); $userID = $_COOKIE['UserID']; if (isset($_REQUEST['UserID'])) { $id = mysql_real_escape_string($_REQUEST['UserID']); $result = mysql_query("SELECT * FROM pokemon_info WHERE user_id = '$id'"); if($row = mysql_fetch_array($result)) { echo "<table border='1' bgcolor='lightgrey'> "; echo "<th>UserID " . $row['user_id'] . "</th>"; echo "<br /><br />"; echo "<tr>"; echo "<td><center>" . $row['pokemon_name'] . "<br /><img border='0' src='" . $row['pokemon_image'] . "'></center></tr></td>"; echo "<tr><td>Attack: " . $row['pokemon_attack'] . "</tr></td>"; echo "<tr><td>Defence: " . $row['pokemon_defence'] . "</tr></td>"; echo "<tr><td>Level: " . $row['pokemon_level'] . "</tr></td>"; echo "<tr><td>EXP: " . $row['pokemon_exp'] . "</tr></td>"; echo "<tr><td><b>Moves:</b> <br /> " . $row['attack1'] . "<br />" . $row['attack2'] . "<br />" . $row['attack3'] . "<br />" . $row['attack4'] . "<br /></tr></td></table>"; } include('bottom.php'); ?> Give me an unexpected $ error? Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 *bump* Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 16, 2007 Share Posted December 16, 2007 This doesnt make sense <a href="viewparty?userID=<?php echo $_REQUEST['UserID']; ?>">Link text</a> userID has to be chosen from your mysql database/ You can do this, but you'll get nowhere with it. Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 Well then can you edit my scripts and show me where and what? Quote Link to comment Share on other sites More sharing options...
Xyphon Posted December 16, 2007 Author Share Posted December 16, 2007 bump Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 16, 2007 Share Posted December 16, 2007 unexpected $ error? means you missed something maybe a dot, terminator etc.. Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 16, 2007 Share Posted December 16, 2007 <a href="viewparty?userID=<?php echo $_REQUEST['UserID']; ?>">Link text</a> <?php include('Connect.php'); include('top.php'); $userID = $_COOKIE['UserID']; if (isset($_REQUEST['UserID'])) { $id = mysql_real_escape_string($_REQUEST['UserID']); $result = mysql_query("SELECT * FROM pokemon_info WHERE user_id = '$id'"); if($result){ $row = mysql_fetch_array($result); echo "<table border='1' bgcolor='lightgrey'> "; echo "<th>UserID " . $row['user_id'] . "</th>"; echo "<br /><br />"; echo "<tr>"; echo "<td><center>" . $row['pokemon_name'] . "<br /><img border='0' src='" . $row['pokemon_image'] . "'></center></tr></td>"; echo "<tr><td>Attack: " . $row['pokemon_attack'] . "</tr></td>"; echo "<tr><td>Defence: " . $row['pokemon_defence'] . "</tr></td>"; echo "<tr><td>Level: " . $row['pokemon_level'] . "</tr></td>"; echo "<tr><td>EXP: " . $row['pokemon_exp'] . "</tr></td>"; echo "<tr><td><b>Moves:</b> <br /> " . $row['attack1'] . "<br />" . $row['attack2'] . "<br />" . $row['attack3'] . "<br />" . $row['attack4'] . "<br /></tr></td></table>"; } include('bottom.php'); ?> try 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.