Reputation: 195
I'm a beginner in php/html
and i need your help guys..
I just want to post the barangay
values which are
1- huyon huyon
2- talojongon
and when there's the same barangay
it should only displays as one...not including the disease.
Please help it will be appreciated:This is my current code
status for barangay receive for disease
SEE THE PICTURES BELOW
<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
Upvotes: 0
Views: 56
Reputation: 29344
Use DISTINCT
to remove duplicate rows
Change your query to
$sql = 'SELECT DISTINCT * FROM patients WHERE Diseases="asd"';
Upvotes: 2