去某人的个人资料

时间:2014-09-12 02:47:31

标签: php mysql

我有这个用户列表页面,我希望用户能够点击用户用户名,它会将它们发送到那里的个人资料页面,我将如何继续这样做?

此行是用户点击用户的用户名

的地方

echo "<td class='info'><a href=''>". $people_list['username']."</a></td>";

同样在我的.htaccess中,我有一个代码,这样我就可以转到用户个人资料,我所做的只是http://www.example.com/username

<?php
include 'core/int.php';
include 'includes/head.php';
include 'head.php';
include 'includes/body.php';
include 'body.php';

$people_list="SELECT * FROM users";

$people=mysql_query($people_list);

?>
<html>
<head>
<style>
.owner {
    color: orange;
}
</style>
</head>
<body>
<pre>
<table class="table table-bordered">
      <thead>
        <tr>
          <th>ID</th>
          <th>Username</th>
          <th>Email</th>
        </tr>

      <?php

     while($people_list=mysql_fetch_assoc($people)){
     echo "<tr>";
     if ($people_list['username'] == KillerDucky1){
      echo "<td>". $people_list['user_id']."</td>";
      echo "<td class='warning'><a class='owner' href=''>". $people_list['username']."</a></td>";
      echo "<td>". $people_list['email']."</td>";
     } else {
          echo "<td>". $people_list['user_id']."</td>";
          echo "<td class='info'><a href=''>". $people_list['username']."</a></td>";
           echo "<td>". $people_list['email']."</td>";
        echo "</tr>";     
     }
     }     
      ?>
      </thead>
      </pre>
</body>
</html>

2 个答案:

答案 0 :(得分:2)

您只需将用户名放在<a>链接标记中:)

<a href='/".$people_list['username']."'>...</a>

答案 1 :(得分:1)

您可以尝试将用户名添加到锚点的href

echo '<td class="info"><a href="/'. $people_list['username'] .'">'. $people_list['username'].'</a></td>';

应该给你这样的东西:

<td class="info"><a href="/username">username</a></td>