PHP表可链接列

PHP表可链接列,php,mysql,Php,Mysql,您好,我有一个查询,列出所有用户,我想能够点击用户名,并进入用户信息页面,所以我的问题是如何将用户名传递给其他php while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><font color='white'>" . ++$i . "</font></td>"; echo "<td><a href='page2.php'

您好,我有一个查询,列出所有用户,我想能够点击用户名,并进入用户信息页面,所以我的问题是如何将用户名传递给其他php

    while($row = mysql_fetch_array($result)) {
  echo "<tr>";
  echo "<td><font color='white'>" . ++$i . "</font></td>";
  echo "<td><a href='page2.php'><font color='white'>" . $row['1'] . "</font></a></td>";
  echo "<td><font color='white'>" . $row['2'] . "</font></td>";
  echo "<td><font color='white'>" . $row['3'] . "</font></td>";
  echo "<td><font color='white'>" . $row['4'] . "</font></td>";
  echo "</tr>";
}
表很好,我只需要一种方法将select用户名传递到page2.php

提前谢谢

编辑:

    while($row = mysql_fetch_array($result)) {
  echo "<tr>";
  echo "<td><font color='white'>" . ++$i . "</font></td>";
  echo "<td><a href='page2.php?nome='".$row['nome']."><font color='white'>" . $row['nome'] . "</font></a></td>";
  echo "<td><font color='white'>" . $row['sexo'] . "</font></td>";
  echo "<td><font color='white'>" . $row['idade'] . "</font></td>";
  echo "<td><font color='white'>" . $row['diabetes'] . "</font></td>";
  echo "</tr>";
}
page2.php:

    include_once 'ligacao.php';
$name = $_GET['nome'];
echo "<table border='1' align='center'>
<tr>
<th><font color='white'>Registo</font></th>
<th><font color='white'>Name</font></th>
</tr>";

echo "<tr>";
  echo "<td><font color='white'>" . ++$i . "</font></td>";
  echo "<td><font color='white'>" . $name . "</font></td>";

  echo "</tr>";
编辑2:

我如何在页面中间并排排列2个表?

    echo "<table border='1'>
<tr>
<th><font color='white'>Glicemia</font></th>
<th><font color='white'>Hidratos</font></th>
<th><font color='white'>Peso</font></th>
<th><font color='white'>Descri&ccedil&atildeo</font></th>
<th><font color='white'>Timestamp</font></th>
</tr>";

while($row = mysql_fetch_array($result)) {
echo "<tr>";
  echo "<td><font color='white'>" . $row['glicemia'] . "</font></td>";
  echo "<td><font color='white'>" . $row['hidratos'] . "</font></td>";
  echo "<td><font color='white'>" . $row['peso'] . "</font></td>";
  echo "<td><font color='white'>" . $row['descricao'] . "</font></td>";
  echo "<td><font color='white'>" . $row['time'] . "</font></td>";
  echo "</tr>";
}

echo "<table border='1'>
<tr>
<th><font color='white'>Medicamento</font></th>
<th><font color='white'>Timestamp</font></th>
</tr>";

while($row = mysql_fetch_array($resultq)) {
echo "<tr>";
  echo "<td><font color='white'>" . $row['medicamento'] . "</font></td>";
  echo "<td><font color='white'>" . $row['time'] . "</font></td>";
  echo "</tr>";
}

您可以将其作为url参数传递,并在page2.php中使用$\u GET,如:

更新:: 您的代码似乎有引号问题,请尝试更改为:

....
echo "<td><a href='page2.php?nome=" . $row['nome'] . "'><font color='white'>" . $row['nome'] . "</font></a></td>";
...

不再支持mysql_*函数,它们已经不再维护,将来也将继续使用。您应该使用或更新您的代码,以确保将来项目的功能。当我们讨论折旧垃圾的主题时,请不要使用字体标记用户名在$row['1']中,因此如果我单击此按钮,将显示该用户名或表中的最后一个用户名?@user3697305因为您正在循环数据库记录,如果$ROW(1)包含用户名,那么它将被添加到循环中的每一个TD中。我尝试了一个回音,但是我什么也没得到……不应该是Page 2。PHP?用户名=显示在URL上选择的用户名?可以帮助1个更多的事情:如何在页面中间并排对齐2个表,查看新的编辑。
$username = $_GET['username'];
....
echo "<td><a href='page2.php?nome=" . $row['nome'] . "'><font color='white'>" . $row['nome'] . "</font></a></td>";
...