overlordofevil Posted March 3, 2008 Share Posted March 3, 2008 I am working with a member db. I am pulling a list of all members with their id and name. Now what I want to do is take the id and make a "link" so when an admin clicks on the id it will bring up a page that shows that particular member's info. What I have so far is this. <html> <body> <?php include ("var.inc"); $conn = mysql_connect($msql_server, $msql_user, $msql_password) or die ("Unable to Connect"); mysql_select_db($msql_db, $conn) or die ("Unable to Connect to DB"); $query = "SELECT * FROM user join id ON ( id.id = user.id ) where id.lvl='player' and ORDER BY user.lastname, user.firstname"; $result = mysql_query($query) or die ("Couldn't execute query agian."); echo "<table border='1' cellspacing='15'>"; echo "<tr><td colspan='12'><hr></td></tr>"; echo "<tr><td>Player's ID</td><td>Player's Name</td></tr>"; while ($row = mysql_fetch_array($result)) { extract($row); $pname= "$firstname $lastname"; echo "<tr><td><a href='index.php?action=viewplayer&id=$id'>$id</a></td><td>$pname</td><td>$subscribed_date</td></tr>\n"; } echo "<tr><td colspan='12'><hr></td></tr>\n"; echo "</table>\n"; ?> </body> </html> ok so I have this line which lets me have the "hyperlink" ( i found this but couldn't get any explanation with this). <a href='index.php?action=viewplayer&id=$id'>$id</a> now what I am trying to figure out is how to get this to work. I see that the code is calling a page (index.php),but after that I don't understand what it is doing. I am assuming action is calling a function but thats my next question how would I write a function that would take the id, call up the members file and display it with out using a return as the instructions for writing a function says to do. ok anyway if someone could explain how this "link" works I would really appreciate it. Thanks Quote Link to comment Share on other sites More sharing options...
Baabu Posted March 3, 2008 Share Posted March 3, 2008 <tr><td><a href='display.php?action=viewplayer&id=$id'>$id</a></td><td>$pname</td><td>$subscribed_date</td></tr>\n"; well i have just changed the name for the page oki now go to display.php code do something like this <?php $uid=$_get["id"] $connect//use this variable to connect to database $selectdb//select the database and then perform the query $query="select from users where id='$uid'"; $result=mysql_query($query)//do the query and then display the result by using anymethod like while($row=mysql_fetch_array($result) { echo $row["name"]; //here goes the rest of the code or info } ?> Hope it works for u 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.