bullbreed Posted January 18, 2010 Share Posted January 18, 2010 Hello. This may be a simple one but I have used a php script that calls some information out of the database and shows it in a row below the headers like this; Name--------------Username-----------Email-----------------More Info Bob Cratchet--------Bobby----------------Bob@bob.con------More Mary Cratchet-------Bobby----------------Bob@bob.con------More Bill Cratchet----------Bobby----------------Bob@bob.con------More Dan Cratchet--------Bobby----------------Bob@bob.con------More What I want to know is the code I would put in the More link at the end that would open a new page and show information from the database that is relevant to the username of the person. Heres what I have so far <table> <tr> <th>Name</th> <th>Username</th> <th>Email</th> <th>More Info</th> </tr> <?php $sql = "SELECT `name`, `username`, `email` FROM users WHERE `userlevel`=1"; $query = mysql_query($sql) or die(myslq_error()); while($row = mysql_fetch_assoc($query)){ ?> <tr> <td><?php echo $row['name']; ?></td> <td><?php echo $row['username']; ?></td> <td><?php echo $row['email']; ?></td> [color=red]<td><a href="WHAT GOES HERE">More</a></td>[/color] </tr> <?php } ?> </table> Link to comment https://forums.phpfreaks.com/topic/188831-click-link-opens-user-relative-info/ Share on other sites More sharing options...
Buddski Posted January 18, 2010 Share Posted January 18, 2010 Do you have a unique id for each of your users? if so echo '<a href="detailspage.php?user_id='.$row['id'].'">More</a>'; or something. Link to comment https://forums.phpfreaks.com/topic/188831-click-link-opens-user-relative-info/#findComment-996889 Share on other sites More sharing options...
daydreamer Posted January 18, 2010 Share Posted January 18, 2010 Code 4 detailspage.php: $user_id=mysql_real_escape_string($_GET['user_id']); $userinfo=mysql_query(SELECT * FROM users WHERE id=$user_id) Link to comment https://forums.phpfreaks.com/topic/188831-click-link-opens-user-relative-info/#findComment-996890 Share on other sites More sharing options...
bullbreed Posted January 18, 2010 Author Share Posted January 18, 2010 Ah I see. In my case the unique column in the table is the username. The reason being is that I have 2 tables and I needed a column in each so I can call the info from 2 tables (join). My register script wont let you register with a username that has already been taken. So when he user clicks on the link it will go to a new page clientinfo.php and show the data from both tables. Well, thats what I'm attempting anyway. lol Link to comment https://forums.phpfreaks.com/topic/188831-click-link-opens-user-relative-info/#findComment-996893 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.