我是php/html
的初学者,我需要你的帮助..
我只想发布<{p>的barangay
值
1- huyon huyon
2- talojongon
当有相同的barangay
时,它应该只显示为一个......不包括疾病。
请帮助我们将不胜感激:这是我目前的代码
barangay的状态 接受疾病
看下面的图片
<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
答案 0 :(得分:2)
使用DISTINCT
删除重复的行
将您的查询更改为
$sql = 'SELECT DISTINCT * FROM patients WHERE Diseases="asd"';