在这里我创建了客户的链接。
<a name="id" href="https://127.0.0.1/new taxicab/account/driver/profile/index.php?id=<?php echo $data['id']; ?>"><?php echo $data['fullname']; ?></a>
index.php 是
<?php $connection = new mysqli("localhost", "root", "black9024!@","new_taxicab");
$id = ($_GET['id']);
if (empty($_GET['id'])){
header("location:cheat.php");
die();
$sql = "select * from driver where id = '$id'";
$result = $db->sql_query($sql) or die (mysqli_error($sql));
while($rws = mysqli_fetch_array($result)){}
echo $rws['fullname'];?>
<?php echo $rws['fullname'];
}
?>
但是它不能工作,我知道这是错的,但是写了什么,请给我一些建议。
最佳答案
在 while 循环中,echo $rws['fullname'] 位于 while 的大括号之外。尝试:
<?php
$connection = new mysqli("localhost", "root", "black9024!@","new_taxicab");
$id = ($_GET['id']);
if (empty($_GET['id'])){
header("location:cheat.php");
die();
}
$sql = "select * from driver where id = '$id'";
$result = $db->sql_query($sql) or die (mysqli_error($sql));
while($rws = mysqli_fetch_array($result)){
echo $rws['fullname']; <-- Here
};
?>
关于php - 如何通过搜索用户并单击其链接来查看用户的个人资料,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49168354/