php - 如何通过搜索用户并单击其链接来查看用户的个人资料

标签 php html mysql profile

在这里我创建了客户的链接。

<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/

相关文章:

php - Laravel Backpack 进入新的时间领域 从 1970 年开始日历

mysql - 使用联接表中的条件限制 SUM() 中包含的结果?

php - 如何在 laravel blade 中一次性推送

PHP: 安装 mysqlnd_ms 失败: make: *** [php_mysqlnd_ms.lo] error 1

html - 行内 block 的不透明度

HTML 敏捷包 - 获取页面摘要

php - php mysql 中的日期时间实现

php - 关于 PHP 命名空间的几个问题

php - 如何在配置了 s2Member 的 WordPress 中获取所有 EOT 设置为从今天起两周后到期的成员?

jquery - 使用 jQuery 按类对 li 元素进行排序