$id 值能成功获取,可是为什么还不能显示出数据呢?<?php
$id=$_GET["id"]; $conn=mysqli_connect("localhost","root","","test");
$sql="select * from login where id=".$id;
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($result);?><html>
<body>
<form action="update.php" method="post">
编号:<input type="text" name="id" value="<?=$row['id']?>" readonly="true" /><br/>
用户名:<input type="text" name="username" value="<?=$row['username']?>"/><br/>
密码:<input type="text" name="password" value="<?=$row['password']?>"/><br/>
<input type="submit" value="确定"/>
<input type="reset" value="取消"/>
</form>
</body>
$id=$_GET["id"]; $conn=mysqli_connect("localhost","root","","test");
$sql="select * from login where id=".$id;
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($result);?><html>
<body>
<form action="update.php" method="post">
编号:<input type="text" name="id" value="<?=$row['id']?>" readonly="true" /><br/>
用户名:<input type="text" name="username" value="<?=$row['username']?>"/><br/>
密码:<input type="text" name="password" value="<?=$row['password']?>"/><br/>
<input type="submit" value="确定"/>
<input type="reset" value="取消"/>
</form>
</body>
while($row=mysqli_fetch_array($result))
{
echo $row[字段名];
} 现在就没有问题了。
如果按id查出来是多条记录,那就按三楼的写法。具体位置,lz自己看手册吧