gpt4 book ai didi

php - 显示数据库值?

转载 作者:行者123 更新时间:2023-11-29 07:05:04 26 4
gpt4 key购买 nike

我是 php/html 的初学者,我需要你们的帮助..

我只想发布 barangay

1- huyon huyon
2- talojongon

当存在相同的描笼涯时,它应该只显示为一个......不包括疾病。

请帮忙,我们将不胜感激:这是我当前的代码

描笼涯的状态因病领取

看下面的图片

 <div id="wrapper">
<br><center><h3>TOP DISEASE IN THIS MONTH</h3></center>

<br>
<table id="keywords" class="table table-striped table-bordered">
<thead>
<tr>

<th><center>Barangay</th></center>
<th><center>Diseases</th></center>


</tr>
</thead>
<tbody>
<?php
include 'database.php';
$pdo = Database::connect();
$sql = 'SELECT * from patients WHERE receive="asd"';
foreach ($pdo->query($sql) as $row){
echo '<tr>';
echo '<td><center>'. $row['status'] . '</center></td>';
echo '<td><center>'. $row['receive'] . '</center></td>';

}
Database::disconnect();
?>
</tbody>

    </div></div>



            <a class="btn btn-success" href="mail.php">Back</a>
<a class="btn btn-success" href="index.php">Home</a>
</p></center>

There are the same barangay huyon huyon so the another must be delete

This is my current output..with the same

最佳答案

使用DISTINCT删除重复行

将您的查询更改为

$sql = 'SELECT DISTINCT * FROM patients WHERE Diseases="asd"';

关于php - 显示数据库值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42031155/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com