PHP查询、web开发

PHP查询、web开发,php,mysql,Php,Mysql,我已经连接到mysql数据库并从表中回显值 while($data = mysql_fetch_array($res)) { ?> <a href="nextpage.php"<?php echo $data['rowname'] ?></a> <?php } ?> while($data=mysql\u fetch\u array($res)) { ?> 问题是当我在nextpage.php上单击特定链接时,它应该只显示a

我已经连接到mysql数据库并从表中回显值

while($data = mysql_fetch_array($res))
{
?> 
    <a href="nextpage.php"<?php echo $data['rowname'] ?></a> 
<?php 
}
?> 
while($data=mysql\u fetch\u array($res))
{
?> 
问题是当我在
nextpage.php
上单击特定链接时,它应该只显示a href单击值的结果。因此在
nextpage.php
上,我定义了类似于
SELECT*from tablename的内容,其中rowname='a href value'

现在的情况是,无论我点击哪个链接,它都只显示最后一个
行名
值,这非常明显


我尝试过表单、数组和会话,但都没用。我该如何解决这个问题?

href应该是这样的

<a href="nextpage.php?val=<?php echo $data['rowname']; ?>"><?php echo $data['rowname']; ?></a> 

然后在下一页中,您可以使用$\u GET['val']并将其传递到选择查询

尝试下面的示例

page1.php

while($data = mysql_fetch_array($res))
{
    echo "<a href='nextpage.php?id=".$data['rowname']." >". $data['rowname'] ."</a>";
}
?> 
 $qry = mysql_query("select * from [table_name] where id = ".$_GET['id']."",$con);
 while($data = mysql_fetch_array($res))
 {
        echo $data[0];
 }

在下一页上,使用
$\u GET['id']
将值传递给sql查询。

$\u G?我猜这是一个输入错误=)对不起,它的$\u GET['val'](1)您没有关闭